Join Now

Mostly Flash Lite and PyS60 :)

Flash Lite: Effectively using gotoAndPlay & gotoAndStop

chall3ng3r | 18 February, 2008 21:57

Hey all,

This is my first post regarding the Flash Lite tips'n tricks I am planning to share on this blog. So, lets get started.

As Flash Lite 1.1 supports pre-AS1 Flash 4 scripting syntax, the developer have to use tellTarget statement to access objects from deferent object.

For example if there are two objects on the stage, menu_mc and controller_mc. To perform a quick gotoAndPlay action from controller_mc to menu_mc, you might be using the following code:

tellTarget("../menu_mc")
{
    // play SlideUp frame
    gotoAndPlay("slideUp");
}

While this works pretty well, but you can also do this via just a single gotoAndPlay call. gotoAndPlay and gotoAndStop also accepts paths, so you can simply pass the object path along with frame label or number to goto command. Like the same operation we did with tellTarget above can also be done as follows:

// play SlideUp frame
gotoAndPlay("../menu_mc:slideUp");

You can use relative paths as well as absolute paths with this approach.

This trick is quite useful when you have to do a quick goto action, but if you need to perform multiple actions, then you're good to go with tellTarget.

Update: BTW, you can use the same trick with latest versions of Flash / Flash Lite.

Update: Scott has posted a nice example use of this tip on his blog, check it out.

Stay tuned for more!

// chall3ng3r //

 
 
Powered by LifeType