Help Please, Linking from a swf in a Scrollpane to positions on the main timeline

I have a scrollpane where I have loaded a swf of many small images that are set up as buttons.
How do I create the link between this swf/actionscript to the main fla/timeline that the scrollpane is contained in?
Thanks

Buttons function with eventListeners, if they are actual button symbols then you should have an unique instance name, otherwise convert them to symbols and name the instances, if they are symbols and named then you can code them to do whatever you want.
Add an event listener and function call for each button in the actionscirpt of the swf and provide the targets of the frame, anchor, or label for the event in the function.
img1_btn.addEventListener(MouseEvent.CLICK, img1Handler);
img2_btn.addEventListener(MouseEvent.CLICK, img2Handler);
img3_btn. etc...
function img1Handler(event:MouseEvent):void
     //go to and stop on the frame to display
     //you can also use frame labels or anchors
     // gotoAndStop("label");
     gotoAndStop(2);
function img2Handler(event:MouseEvent):void
     //if you put the images in scene 2 for example then call the Scene the frame is in.
     // in this case for example, frame 3, Scene 1
     gotoAndStop(3, "Scene 1");
Duplicate for each button/img.
Have fun.

Similar Messages

  • Passing a variable from a movie clip to the main timeline

    Hi,
    I'm having trouble passing a variable from a movie clip in my
    flash file to the main timeline.
    I have a movieclip with the instance name IntroNav which
    contains several buttons. Clicking a button sets the variable
    "page" to a specific name, i.e. page = "home"
    However, outside of the movie clip, on the main timeline I am
    unable to call this variable, and "page" seems to have no value.
    Can anyone tell me why this is and how to solve it?
    Thanks

    Umm, yes ... declare your variables correctly.
    var page:String = new String(); //proper complete
    var page:String; //strict typing
    var page:String = "home"; //stirct typing with value
    declaration
    Do not declare the variable in your buttons, you would have
    to do so in every button and be constantly resetting the value.
    Declare it on the main timeline at the lowest level. You do not
    need to use it as a _global, you just need to resolve your path
    issues. You can 'set' the variable value from a button, without any
    problem, but you have to call to the variable correctly.
    You do not 'name' a variable as "_root.page" , the '_root'
    refers to the lowest level of the SWF or the main timeline, as does
    a call to ' _level0' (that's a zero). If the variable is declared
    on the main timeline, and you're calling from the MC/button or
    anywhere you can refer to the variable by calling to it by
    the proper path of '_root.page'
    To set the variable from any of your button/MC instances
    call:
    _root.page = "value"; OR _level0.page = "value";
    But you must have the varibale declared on the main timeline,
    and only once and the playhead should be stopped or it will reset
    the value to the default upon looping.

  • Safari keeps crashing every time I try to open a link from a different application, i.e. Mail. The trouble report says that some problem occurs with libcooliris.dylib plug-in. Can any one help?

    Safari keeps crashing every time I try to open a link from a different application, i.e. Mail. The trouble report says that some problem occurs with libcooliris.dylib plug-in. Can any one help?
    Thanks!

    Dear Linc,
    Thank you for the advice, John Blanchard1  and Linc Davis
    As suggested in your reference thread I removed "/Library/Printers/hp/PDEs/hpPostScriptPDE.plugin" and the problem has been resolved.
    I am guessing the the plug-in for the hp printers got corrupted and effected every thing, or became unsuitable when I installed an Apple update. I would be most grateful if you can confirm how the problem was coursed so I can understand and learn from this experiance.
    Ash

  • Help, please.  My iMac sound has gone all stat·ick·y The Video won't play correctly or at all.  I have a Model Name:     iMac   Model Identifier:     iMac12,1   Processor Name:     Intel Core i5   Processor Speed:     2.7 GHz  I am running OSX 10.6.8

    Help, please.  My iMac sound has gone all stat·ick·y The Video won't play correctly or at all.  I have a Model Name:
    iMac   Model Identifier:
    iMac12,1   Processor Name:
    Intel Core i5   Processor Speed:
    2.7 GHz  I am running OSX 10.6.8

    So just to be clear on a few things:
    Should partitioning the hard drive not work is it undoable?
    Will this have any impact on doing a complete erase and reinstall and will that restore it back from the process?
    Is there a limited amount of space that makes this process ineffective?
    I have never had to do this sort of thing so I just want to be sure I don;t wind up in the dog house *)
    Thanks again

  • Controlling a Movie Clip on the Main Timeline from a loaded SWF?

    Is it possible to control a MovieClip on the main timelne from another loaded clip?
    I see posts that control loaded clips, but most are all from the loader in the main timeline.  I have a moviclip on the main timeline that I want to make visible or invisible depending on what keyframe is playing in another loaded swf.
    If I try to call the movieClip from the loaded SWF I get "error #1119.  Access of possibly undefined property...." because it doesn't exist in the loaded SWF, just the main timeline. 
    The old AS2 way just used "_root".  Since "_root" doesn't exist any more, how do you control items on the main TimeLine from a loaded SWF?

    I am not clear what you mean because you are saying you are trying to target a movieclip that does not exist where you are trying to target it.
    Try using a trace to see what you are targeting when you you target the MovieClip(parent.parent)....
    trace(MovieClip(parent.parent));
    The other approach I mentioned earlier is the more OOP-correct approach if you would rather try that way.  Here's a rough outline of it...
    AS3 - Dispatch Event
    http://forums.adobe.com/thread/470135?tstart=120
    Example:
    Add something to trigger the event in the child (your loaded swf):
    dispatchEvent(new Event("eventTriggered")); (
    if dispatchEvent problem, see: http://www.kirupa.com/forum/showthread.php?p=1899603#post1899603)
    In your loading/parent swf, listen for the complete event on the Loader.contentLoaderInfo.  In the complete event handler, add a listener for the event on the loaded swf.
    // event handler triggered when external swf is loaded
    function loaderCompleteHandler(event:Event) {
        MovieClip(event.currentTarget.content).addEventListener("eventTriggered", eventHandler);
    function eventHandler(event:Event):void {
        trace("event dispatched in loaded swf");
       // this is where your main file can set the visible property of your movieclip

  • Help.I have an itunes account and wanted to set up a new one .All my music from existing account loaded automatically onto new itunes account.The main point of this was to start with a blank canvass

    help.I have an itunes account and wanted to set up a new one .All my music from existing account loaded automatically onto new itunes account.The main point of this was to start with a blank canvass

    Yes
    Put all the music on one computer, make sure it is authorized for all accounts, sync.

  • How do you reference the main timeline of swf1 from swf2 when swf2 is loaded into swf1?

    on this link          http://kb2.adobe.com/community/publishing/918/cpsid_91887.html
    I found this script, but I can not use it can anyone help me
    // create a variable to reference swf1's main timeline
    var swf1Main_mc:MovieClip;  // this assumes that swf1 is a movieclip.
    // create your listener to ensure this loaded swf has been added to the display list and can therefore obtain a
    // reference to its main timeline (which is always the main timeline of the loading swf).
    this.addEventListener(Event.ADDED_TO_STAGE, initF);
    function initF(e:Event):void{
        swf1Main_mc = MovieClip(this.root);

    You don't make it clear what event finish is for. But let's assume that your MC is being loaded from the clip that you're referring to as root. In the main Document Class of that swf, you'd have
    protected var customSwf:CustomSwf;//customSwf is the Class that defines your functionInSwf1protected function someFunction():void {
         var loader:Loader = new loader();
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE onLoaderLoaded);
         //rest of your loader loading code here
    protected function onLoaderLoaded(e:Event):void {
          //add to display list (you already know how to do, so I'm not writing the code)
         EventDispatcher(e.target).removeEventListener(Event.Complete, onLoaderLoaded);
         //if you had a legitimate need for path (which you don't) in mcExternal, you'd set it like this:
         this.mcExternal.path = LoaderInfo(e.target).content as MovieClip;
          //this is what you actually need to care about to do this correctly
          customSwf = LoaderInfo(e.target).content as CustomSwf;
    Now, the Class that you apply to the library symbol you're using for mcExternal should have code similar to this:
    protected function fEvent(e:Event):void {
         dispatchEvent(new Event('giveYourEventADescriptiveNameBasedOnWhatYoureReallyDoingHere', true));
    back in your main document Class:
    //should probably call from the constructor or somewhere early in the process
    protected function init():void {
         //use your real event name--your code isn't expressive enough I could guess a good name
         addEventListener('giveYourEventADescriptiveNameBasedOnWhatYoureReallyDoingHere', onEventHappened);
    protected function onEventHappened(e:Event):void {
         customSwf.customFunctioninSwf1();
         customSwf.changeVisualState();//let custom swf change alpha and change the frame #
    To the untrained I, this looks like about the same amount of code and slightly more trouble, but changing the design like this will make it much more tolerant of the changes that nearly all clients will want after you've built version 1. mcExternal's code doesn't have to change at all if swf1 changes, and your root Class already knows abotu swf1 anyway, since it's doing the loading, so having it work with it a little more doesn't hurt.
    Moving the change of visual state into your custom swf means that changes in that swf won't affect your main document Class, though you will probably have to recompile the main document unless you go to using an Interface (a topic for another day).

  • Attach a movieclip from the main timeline inside another movieclip.

    I need help with the game I am working currently. On the main timeline Actions frame I have a loader class called myLoader. I attached that to a movieclip called currentSWF. I have a movieclip called SpinningCard in the library which I dynamically attached to the stage. Inside the SpinningCard movieclip there is another movieclip Card. In the Card movieclip I have 10 frames and on each frame I want to attach a different instance of the movieclip currentSWF. How can I do achieve that?
    here's what I have till now...
    On the main timeline Actions frame...
    var loader:Loader=new Loader();
    loader.load(new URLRequest("CardGraphics.swf"))
    var currentSWF:MovieClip;
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
       function swfLoaded(e:Event):void {
       currentSWF = MovieClip(loader.contentLoaderInfo.content);
       addChild(currentSWF);
    Inside the Card movieclip on the first frame I have this code...
    var a1:MovieClip = MovieClip(parent.parent.getChildByName('currentSWF'));
    CardFrame1.addChild(a1);
    //CardFrame1 is an empty movieclip which is there on the frame 1 of Card Moveiclip.
    I am getting error : Parameter must be non-null. How can I solve. Can anyone please help me.

    Hi Nabren
    I'm also looking to load a library based movie-clip into a stage based movie-clip, so that I can inturn swap it with other movie clips to act as different pages (page2_mc etc) which will be used in different sections of the application to give chapters as such.
    I've had a go at the above but can't get a result, though it did not throw an error. I also had a trace() on each side and both of those triggered.
    The stage based mc I called pageMC and the content mc I called content the same as your example
    trace('loader - cx');
    var loader:Loader=new Loader();
    var pageMC:MovieClip;
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
    function swfLoaded(e:Event):void {
    pageMC = MovieClip(loader.contentLoaderInfo.content);
    pageMC.name = "pageMC";
    addChild(pageMC);
    trace("Menu 4");
    I'd appreciate some assistance. I would like to use internal MC's as I want to put the application to iOS and Android and believe by using movieclips I should be able to have some code with them whereas importing swf's I can't.
    Thanks

  • How can I reference the main timeline on a swf once it was loaded into another?

    I have an swf with some custon animation functions using actionscript 3. I'm refering to the main timeline with Movieclip(root) and it works just fine.
    However, this swf is going to be loaded inside another (a custom player), and when that happends, everything stops working.
    I think it's because the Movieclip(root) is now referencing to the loader swf and not the loaded anymore, but I just can't find any information on how to fix that.

    This is basically what I´m doing here:
    I'm placing this code on frame 1, and calling the function textAnimate() whenever I need to insert some text.
    // This is a variable I created for tracking the timeline
    var base:MovieClip = MovieClip(root);
    function textAnimate(movieName:String, espera:Number):void {
              //var espera:Number = 1; //Waiting time
              var objeto:MovieClip = base[movieName]; //Variable to select the object
              var posFinal:Number = objeto.x; // Object position
              var posEnter:String = "-160"; // Animation start (relative)
              var posExit:String = "+160"; // Animation end (relative)
              // enter animation
              TweenMax.from(objeto, 1, {x:posEnter, alpha:0, blurFilter:{blurX:40}, ease:Back.easeOut});
              //call exitAnimation() after X seconds
              TweenMax.delayedCall(espera,exitAnimation);
              //exit animation
              function exitAnimation() {
                        TweenMax.to(objeto, 1, {x:posExit, alpha:0, blurFilter:{blurX:40}, ease:Back.easeIn});
    The swf works fine, but once it´s loaded into the player, nothing works anymore. Unfortunately, I don't have the code for the player, and can't change anything about it... :/

  • How do I recerence Movie Clips on the Main Timeline from inside a class?

    Hey everyone, this might be a stupid question but I thought
    I'd ask cause it's making me nuts. I'm all of 2 days into AS3
    (coming from not using Flash at all in YEARS) so feel free to
    consider me ignorant. I do have plenty of application development
    experience in other areas though.
    I can't seem to create a class that can reference an instance
    of a movie clip on my main timeline. I'd post code of what I've
    tried but I've gone through so many desperate edits & wild
    guesses that it was just garbled junk before I deleted it all.
    Basically here's how I figured Flash could work, though maybe
    it doesn't work this way at all.
    I'm assuming that with AS 3 being so big on being a true
    object oriented environment, I wouldn't need to mix my code and
    interface together. Preferably I'd be using the Flash authoring
    tools just to design my interface. Create a button... place it
    somewhere... give it an instance name. Roughly the equivilant of
    Apple's InterfaceBuilder for those of you that might be familiar
    with Cocoa development. I can see maybe having to put a few lines
    of ActionScript onto frame 1 (though really I'm hoping Flash would
    have a better method of kicking off the application at this point
    that using code tied to frames) to load my classes & such, but
    after that I'd like all of my code to be held in external class
    files.
    So maybe I've got:
    Interface.fla - My interface
    Button_1
    Button_2
    TextField_1
    Main.as - My main controller class using to handle all of my
    applications behavior
    SomeClass.as - Some helper Class
    SomeOtherClass.as - Some helper Class
    Main.as would have instructions in its initialization method
    to go ahead & attach events to buttons & initialize
    anything else that needs to happen when the application starts.
    From there on it would all be objects communicating back &
    forth. Button_1 would get clicked with would fire
    Main.someMethod(). Main.someMethod() would then do it's thing and
    set the value of TextField_1. All very clean & code is very
    separated from interface.
    Unfortunately I can't for the life of me figure out how AS3
    classes reference each other like that. There doesn't seem to be
    any kind of a global 'root' or '_root' I can use to locate any
    movie clips on the stage. I've searched the help & the web for
    any kind of simple tutorial but to no avail. My job has tasked me
    with building a flash app for a project but I'd really rather not
    have a tone of ActionScript just shoved into frame 1. That just
    seems... ugh! (::shudder::)
    Can someone maybe point me in the right direction here? I'm
    really willing to do my homework but I can't seem to locate the
    info I need to get started. Also, is there an ActionScript IRC
    channel or something maybe?
    Thanks,
    Cliff

    I worked with the problem last night and the solution I
    started coming to involved creating my own custom document class
    based off which extends MovieClip. My thought is that way I have
    access to the initialization routine of the timeline itself and
    that all of the elements on the main timeline should be
    "properties" of my custom class.
    Is this correct? Is there a down side to doing this & if
    so what is it & why?
    Also, just for my reference, the last time I did anything
    with ActionScript I think I was using '_root' to target the main
    timeline. WHat are the global variable names in AS 3? Is it just
    'root' & 'stage' or 'Root' & 'Stage' or what?

  • How to call a function in a class from the main timeline?

    Hey Guys
    I have a project in Flash with four external AS files, which are linked to items in the library using AS linkage.
    What I want to do is call a function in one of these files from the main timeline, how would I go about doing this? I'm not currently using a document class, most of the code is in Frame 1 of the main timeline.
    Thanks

    // change type to the class name from the instance
    ClassNameHere(this.getChildByName('instance_name')).SomeFunction();

  • How do I set a variable on the main timeline from within a symbol?

    Just getting started with Animate and coming to it from Flash, as may be apparent from my question. How do you set a variable to the main timeline from within a symbol?
    I have 24 pairs of clickable elements, each in their own symbols, and all 24 of those symbols sit inside another symbol. I want all 24 to be able to set the same global variable when clicked. I can't find that this question is addressed anywhere, which makes me think I may be stuck in a Flash mindset and approaching the task in the wrong way. (There are however MANY discussions of how to address objects at different levels in the hierarchy. That's well covered.)
    Relatedly, how do you access a function on the main timeline from within a symbol?
    Adobe should consider putting together a support page (or pages) just for folks migrating form Flash. In the materials I've encountered so far there seems to be a studied effort to refrain from mentioning Flash in any way. I imagine there are a lot of people out there like me who have a deep background in Flash coding, but are just getting started with Animate. We don't need help with most of the basic concepts, but we may still have some pretty basic questions about how to accomplish some things in Animate because our Flash knowledge is getting in the way.

    Hi Bill,
    There are plenty of threads on here about scope, but here's one way to create a global variable:
    // code on Stage.compositionReady
    sym.myGlobalVar = 1;
    Then, anywhere in your project, you can check/set that var like so:
    sym.getComposition().getStage().myGlobalVar = 2;
    And here's one way to create a global function:
    // code on Stage.compositionReady
    sym.myGlobalFunction = function(){
              console.log('myGlobalFunction');
    Then, anywhere in your project, you can call that function like so:
    sym.getComposition().getStage().myGlobalFunction();

  • Convert a movie clip back to the main timeline? Help!

    I hope you guys can help me with this because this is a work project. Here's the situation:
    The entire .fla animation consists of nothing but two really long movie clips. Which are placed on frames 1 and 2 of the main timeline. Now for reasons that are too deep for me to go into explaination about my boss is telling me that I have to have everything main timeline -no movie clips. I've tried copypasting all of the frames but they all paste wayyy to large on the main timeline and they wind up in different places on the stage.
    How can I move all of the frames from my two movie clips onto the main timeline without everything breaking? Better yet - is there any way to just convert a movie clip into an .fla?

    you're on the right track.  note the x,y of your movieclip in frame 1.  create a new layer and paste all the frame 1 movieclip's frames into that new layer.  click the edit multiple frames icon below your timeline.  select all the frames, click an on-stage object.  in the properties panel, change the x,y of the all the selected objects to the previously noted values

  • Control a mc timeline from the main timeline

    Hi there,
    On my main timeline, I load a mc from the library with:
    text_content.attachMovie("text_content", "text_content", 10);
    There is a marker inside this mc called "news". I need a script in the main timeline that will gotoandStop "news" within the "text_content" mc.
    I have tried, amongst others unsuccesfully:
    text_content.gotoAndStop("news", 10);
    _level10.gotoAndStop("news");
    Can anyone tell me how to fix this?
    Many thanks

    Hi, thanks for your help. To describe the scenario a bit better...
    I have an empty mc on the stage called "text_content_mc".
    On the first frame of the main timeline, I load a library mc 'text_content' (identifier name: text_content) into "text_content_mc" using:
    text_content_mc.attachMovie("text_content", "text_content", 10);
    From the main timeline, I have attempted to navigate to marker "news" within the library mc, now inside "text_content_mc" using:
    text_content_mc.text_content.gotoAndStop("news");
    It is not working. What I am doing wrong?
    Hope this makes sense. Thanks.

  • Referencing the main timeline from elsewhere

    From inside a movie clip (button) which is inside a display
    object (buttonSet), I want to gotoAndPlay a specific frame on the
    main timeline. I've tried stage.gotoAndPlay(thisFrame). I got
    closer with gotoAndPlay(stage.thisFrame). I still have something
    wrong.
    I have about 15 frames on the main timeline. Each frame
    contains a myriad of objects all doing different things. Most
    importantly they transition from frame to frame based on the
    current frame (last button clicked) and the next frame (the newly
    clicked button).
    Example: the last button that was clicked was button #4, the
    button I have just clicked is button #2. Based on this knowledge, I
    want the main timeline to gotoAndPlay frame #6.
    Thanks for the aid. :)

    the flash compiler (in strict mode) often has trouble
    "remembering" the class-type of objects/variables. "typing" those
    objects explicitly helps the compiler to overcome erroneous error
    messages.

Maybe you are looking for

  • Smartform of a particular employee with dynamic actions

    Hi All, I am making an HR smartform - pulling data from infotypes  - so I am using logical database pnp. Now Everytime I enter the personal number in the PNP screen, it gives me form with correct data of respective employee. I want to club this smart

  • Processing of retention money

    Dear Friends, We have following requirement: We awarded a PO to vendor in that there is portion of retention money. This is a sort of security money which we keep for getting complete qty / services from vendor. After receiving total qty. , we may pa

  • RSS Bug getting closer to a fix... I really need your help!!  Please?

    Background: Cannot get SUBSCRIBE button to shoot me into iTunes/podcasts like it did before in v06. Situation: (iWeb08) and http://www.threeboysproductions.com is a godaddy domain buy. http://web.mac.com/captmench is the actual address. LONG AND SHOR

  • Skipping music at the start of songs

    Does anyone else find that when playing music from itunes7 that it skips at the start of each song? Me and my flat mate both have the same problem with our music sounding like scratched vinyl every time a song begins. It doesnt happen in any other pl

  • Substitutional Variables

    Q. Create a script name LOADEMP.sql to load rows into my_employee table. Concatenate first letter of firstname and first 7 characters of second name to produce the user id . my code INSERT INTO my_employee(id,last_name,first_name,userid,salary) VALUE