Controller in SmartBuilder that controls imported flash swfs

Working with Media (graphics, audio, video) & other Assets

Moderator: Nav

Controller in SmartBuilder that controls imported flash swfs

Postby Randall Smith » Mon Jan 26, 2009 12:35 pm

Is there a way to create a control bar in SmartBuilder, similar to the control bars used in Captivate, that could control imported swfs? Ideally, this would include a progress bar, play, pause, rewind, etc.
Randall Smith
 
Posts: 40
Joined: Mon Sep 10, 2007 2:25 pm
Location: Madison, WI

Re: Controller in SmartBuilder that controls imported flash swfs

Postby Nav » Tue Jan 27, 2009 1:32 pm

Hi Randy,
I don't believe that we can easily create a control bar in SmartBuilder. You could build these controls directly in Flash and reuse them with other content, so long as your ActionScript didn't interfere with any of the SmartBuilder code (as in not effecting SmartBuilder's ActionScript).

But, if you wanted SmartBuilder actions to control when it would play, pause or rewind, that currently can't be done. We'll be working on adding this functionality to the SWF event messenger widget, but I'm not exactly sure when this will be completed. I'll keep you informed, and see about building a demo controller that you can use or customize.

- Nav
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm

Re: Controller in SmartBuilder that controls imported flash swfs

Postby Nav » Tue Jan 27, 2009 6:09 pm

Well, here's a swf timeline controller thing. You can just grab the controller_mc object and place it on the main timeline of your current animation. Also be sure to grab all the actionscript on the 1st frame.

Give it a whirl, and let me know what you think. It took me a while to create it, and I haven't really tested it out thoroughly. I'll be doing so in the next couple of days when I get breaks between other projects. Let me know if it breaks SmartBuilder or doesn't work properly. Consider it in beta. It effects the main flash timeline. I have another version that effects just a movieclip (and you can paste your animation into that movieclip), which, I imagine, is more stable and less likely to break SmartBuilder.

By the way, it was created in CS4, but the publish settings must be as2 and Flash 8 in order to work with SmartBuilder (or work at all, for that matter, since it was written in as2...).

- Nav
Attachments
scrubber root.zip
(18.28 KiB) Downloaded 379 times
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm

Re: Controller in SmartBuilder that controls imported flash swfs

Postby Randall Smith » Fri Jan 30, 2009 8:14 am

Nav, thanks for the ideas about the controller bar. Unfortunately, we are still using Creative Suite 3 so I can't open the fla that you posted. Could you save it to the CS3 format?

Thanks,

Randy
Randall Smith
 
Posts: 40
Joined: Mon Sep 10, 2007 2:25 pm
Location: Madison, WI

Re: Controller in SmartBuilder that controls imported flash swfs

Postby Nav » Fri Jan 30, 2009 10:46 am

Here you go.

- Nav
Attachments
scrubber root cs3.zip
(9.57 KiB) Downloaded 378 times
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm

Re: Controller in SmartBuilder that controls imported flash swfs

Postby Nav » Tue Feb 17, 2009 12:00 pm

We've updated the SWF Event Messenger widget to include a means of communicating back to the SWF. It is now called the SWF Messenger. There is an example, located in the Shared Library > Examples > Examples using SDK objects, called SWF Messenger example (SDK object).
The sample SWF, and the source file, is located in the Shared Library > Media & Assets > Sample Flash Animations (and source files).

We did not build in a controller bar because this solution is actually more versatile and will allow you to pause, play, and rewind your animation, as well as whatever else you want with your animation! This can be triggered by any SmartBuilder action, including any buttons. Between this and the previously attached controller, you should be able to create any functionality you can think up. The source file for the controller has also been uploaded into the same Sample Flash Animations (and source files) folder.

Using this widget, you can:

* Fire an event from a SWF that SmartBuilder can catch and use as a trigger.
* Send a message from SmartBuilder to the SWF, which can be used to change the state of the SWF.

In Flash, place the following code on the first frame of the main timeline:
Code: Select all
function sbPlay() {
  play();
}
//
function sbStop(){
  stop();
}


This will keep the SWF from playing on the authoring stage.

Setting up an event: SWF -> SmartBuilder communication

This example will show a text object when the SWF event "done" is called.

1. In Flash, simply place the following ActionScript code in your SWF on the frame that you want to fire the event:

Code: Select all
this.smartbuilderRef.fireEvent("done");


Where "done" is the name of the event.

Note: There can be more than one event in a single SWF.

2. In SmartBuilder, create a SWF Messenger object and load your SWF with the above code in it. Be sure to rename the widget so it's easy to find.

3. Then set up an action with the following:

Trigger: SWF Messenger > onEvent
Condition: SWF Messenger > getEvent == done
True Response: Done text > show
False Response: [leave blank]

Note: If there is only one event, it is not entirely necessary to set up a condition, as it will be the only event that is fired from the SWF.

Setting up a message: SmartBuilder -> SWF communication
This example will show make the SWF go to a particular frame.

1. In Flash, place the following ActionScript code on the first frame of your SWF.
Code: Select all
function sbReceiveMessage(name:String, value:String) {
    if (name == "gotoFrame") {
        gotoAndStop(value);
    }
}


Note: There can be several different messages sent to the SWF, but only one at a time. If there is only one message, it is not entirely necessary to set up a condition, as it will be the only message that is sent from SmartBuilder.

2. In SmartBuilder, create a SWF Messenger object and load your SWF with the above code in it. Be sure to rename the widget so it's easy to find.

3. Then set up an action with the following:
Trigger: Jump Button > onClick
Response: SWF Messenger > sendMessage > "gotoFrame", "10"

Hope this does what you need it to!

- Nav
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm

Re: Controller in SmartBuilder that controls imported flash swfs

Postby Nav » Tue Apr 14, 2009 1:43 pm

I'm not entirely sure why, but

Code: Select all
this.smartbuilderRef.fireEvent("ready");

doesn't work on the first frame. Either put it on another frame or nest it inside another function.

- Nav
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm

Re: Controller in SmartBuilder that controls imported flash swfs

Postby Nav » Thu Sep 23, 2010 5:26 pm

Note that there is an example file in the Shared Library > SmartBuilder Media & Assets > Sample Flash Animations folder called "SWF Messenger example content.swf" that you can use to see how it works. The authoring FLA also accompanies it if you want to download it and take a look.

- Nav
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm


Return to Media & Assets

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron
Not able to open ./cache/data_global.php