Hi all. Medium level flash user here. I downloaded a really cool .as3 library that i am incorporating into a flash project (using import), and it does everything i want except one. when a user clicks on an object, the way the developer made it, code in the imported .as3 file executes a gotoURL command. great if you want to open up a new url. but I want to just navigate to a certain frame and view an animation instead from within my flash movie, so i want to replace that line of code with one that will jump to a certain point in the "content" timeline. problem is (being a relative know nothing), i'm not sure how to make a gotoandplay() call to a specific timeline from an imported as3 script. where if it was in the main flash timeline i would just say content.gotoandplay(5) , in the separate as3 library it has no idea what that is. In other languages like VB, you would have some sort of construct like object.whatevertimeline.gotoanplay() and i assume that's doable here, just don't know how to do it. help?
You should just be able to make a few minor adjustments to the class that calls the mouse click.
Add a new property to the class. (google as3 getters/setters if you're unsure on how to do this)
This property holds a reference to the movieclip you wish to gotoAndPlay.
Assign this variable straight after the classes construction to avoid the user clicking and producing a null object.
thanks for that answer. just a followup : you said "this property holds a reference to the movieclip you wish to gotoandplay."
sorry for my ignorance, but i'm not sure what statement i'd use to accomplish that. I looked up setters and getters, but once i have that, how would i then call the gotoandplay? would i then be able to simply say movieclip.gotoandplay(x)? can you point me to the right language constructs to use?
object.whatevertimeline.gotoanplay() and i assume that's doable here
Yes indeed - you'd basically do movieClipInstance.gotoAndPlay(n); How to target the MovieClip in question would depend on the relationship between your class instance (if it's instantiated that is) and the MovieClip.
--
Kenneth Kawamoto
htp://www.materiaprima.co.uk/
it's basically on line 1 of my actions layer i have :
import cardflip.as3.flipScript; (with the file being flipScript.as)
and the code within that flipScript.as file is :
private function goThere(e:MouseEvent):void {
navigateToURL(new URLRequest(thisURL), "_blank" );
}
i want to replace the navigateToURL with something that does :
content.gotoAndPlay(10); (content being the movie clip instance i want to play)
In flipScript.as, where properties are being declared add:
private var contentMC:MovieClip;
public function set contentMC (value:MovieClip):void { contentMC = value; }
Then replace the navigateToURL in goThere() with:
contentMC.gotoAndPlay(10);
Then in the actions layer, after importing flipScript;
var flipScript:flipScript = new flipScript();
flipScript.contentMC = theMcYouWantToPlay;
North America
Europe, Middle East and Africa
Asia Pacific