Skip navigation
Toonces the Cat
Currently Being Moderated

internal navigation from and external .as3 file

Dec 20, 2011 9:23 PM

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?

 
Replies
  • Currently Being Moderated
    Dec 20, 2011 10:14 PM   in reply to Toonces the Cat

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 21, 2011 8:06 AM   in reply to Toonces the Cat

    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/

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 21, 2011 1:20 PM   in reply to Toonces the Cat

    From where and how are you invoking "goThere" function?

     

    --

    Kenneth Kawamoto

    http://www.materiaprima.co.uk/

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 21, 2011 1:53 PM   in reply to kennethkawamoto2

    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;

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points