Help with movieclips

Hi,
I use Flash cc for interactive music education content and I need help with this:
Let´s say I have several sets of movieclips in my library. Each movieclip contains audio and animation (two bars). What I want to do is put several buttons on the stage so the user can click two of them to choose which movieclips are goinge to be loaded from the library and then click PLAY and listen and see the first movieclip and immediately after that will listen and see the second movie clip. Like choosing the pieces (bars) of a song and then playing the song.
The problem is that the ammount of combinations is so huge that I need to find how to do it this way.

Here's the skeleton of what you're after. Filling it in will be left as an exercise to the reader, but basically...
Have a Queue area onstage that shows the current queue of loaded items to play. Show the list of possible movieclips below it and each one clicked in that area adds it to the queue. A click on a movieclip in the queue area deletes it from the queue. There's a play button somewhere beside the queue.
Programming-wise, you will have an array (let's say it's called queueArray). Each movieclip will need a unique instance name, and as it is clicked you will Array.push it onto the queueArray (or delete it of the queueArray if they click it when it's already on there). When they click play, it simply plays queueArray[0] and then queueArray[1].

Similar Messages

  • Help with movieclip

    i am loading pictues into a movieclip loader. all of the
    original size pictues work fine. i have a few other pictues that
    are a different size. how can i get that loader to size to the
    picture when the picture is loaded. i can send my .fla if someone
    can help with this.
    i's like loading a polaroid picture.. a quick flash when the
    next pic is loaded,, but the loader doesn't resize which leaves a
    lot of white on the side of the photo when it's loaded.

    Move your last frame in that circle mc to the yeah frame, or just place something in that yeah frame so that you know you are there.  When you run it and click the button you should see that you actually did go to the yeah frame.  The play() in that yeah frame should be enough to coax it along (it worked for me).

  • Help with movieclip position/layers

    Hello. i am building simple game using as3. I am using AS3 Code to create objects on the stage (by creating a movieclip in the library and linkage them to actionscript and then call them with addChild). i have 2 movieClips the first is need to be in the front of the stage and the second on the back, the user need to click the second movieclip with the mouse click but because the first movieclip is in the front (and in the width of the stage) the second movieclip is not response to the mouse clicks. The first movieclip must be in front. any idea how to solve that issue???

    maybe you can post some example?
    this is my code
    this.addEventListener(MouseEvent.CLICK, kill)
    function kill(event:MouseEvent):void
    this_xml = <Motion duration="5" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
    <source>
    <Source frameRate="30" x="-213.2" y="465.85" scaleX="1" scaleY="1" rotation="0" elementType="movie clip" symbolName="closeCartWheel">
    <dimensions>
    <geom:Rectangle left="-144" top="-214" width="290.1" height="238"/>
    </dimensions>
    <transformationPoint>
    <geom:Point x="0.504825922095829" y="0.8930672268907563"/>
    </transformationPoint>
    </Source>
    </source>
    <Keyframe index="0" tweenSnap="true" tweenSync="true">
    <tweens>
    <SimpleEase ease="0"/>
    </tweens>
    </Keyframe>
    <Keyframe index="4" scaleX="0.208" scaleY="0.208">
    <color>
    <Color alphaMultiplier="0"/>
    </color>
    </Keyframe>
    </Motion>;
    this_animator = new Animator(this_xml, this);
    this_animator.play();
    this_animator.addEventListener(MotionEvent.MOTION_END, die);

  • Need help with duplicating Movieclips!!!

    Hi! I have a movie where I want to call in a movieclip from
    the library (circleMC) and duplicate it 20 times horizontally and
    15 times vertically and offsetting the new duplicates by 20 pixels
    in both directions to fill the stage.
    Also it would be neat if I could set a slight time delay
    between the duplications.
    So far I have the following script but this doesn't
    duplicates the clip in the y direction:
    count = 1;
    while (count<20) {
    _root.circleMc.duplicateMovieClip("circleDup"+count, count);
    setProperty("circleDup"+count, _x, count*20);
    count++;
    Can somebody help with this issue? thank you in advance for
    any help, Attila

    Hi,
    you could use something like this:
    var count:Number = 1;
    function duplicate(){
    _root.attachMovie("circleMC","mc"+count,count,{_x:count%20*20,_y:count%15*20});
    count++;
    if (count == 20) clearInterval(intervalID);
    var intervalID:Number = setInterval(duplicate,100);
    The library symbol must have the linkage ID 'circleMC'
    (rightclick on the MC in the library > linkage > export for
    AS). The attachMovie method can have an initObject parameter where
    you can set the _x and _y properties. The MC gets attached with
    those properties. To have it delayed, put it all in a setInterval.
    hth,
    blemmo

  • I need help with shooting in my flash game for University

    Hi there
    Ive tried to make my tank in my game shoot, all the code that is there works but when i push space to shoot which is my shooting key it does not shoot I really need help with this and I would appriciate anyone that could help
    listed below should be the correct code
    //checking if the space bar is pressed and shooting is allowed
    if(evt.keyCode == 32 && shootAllow){
        //making it so the user can't shoot for a bit
        shootAllow = false;
        //declaring a variable to be a new Bullet
        var newBullet:Bullet = new Bullet();
        //changing the bullet's coordinates
        newBullet.y = tank_mc.y + tank_mc.width/2 - newBullet.width/2;
        newBullet.x = tank_mc.x;
        //then we add the bullet to stage
        addChild(newBullet);
    listed below is my entire code
    import flash.display.MovieClip;
        //declare varibles to create mines
    //how much time before allowed to shoot again
    var cTime:int = 0;
    //the time it has to reach in order to be allowed to shoot (in frames)
    var cLimit:int = 12;
    //whether or not the user is allowed to shoot
    var shootAllow:Boolean = true;
    var minesInGame:uint;
    var mineMaker:Timer;
    var cursor:MovieClip;
    var index:int=0;
    var tankMine_mc:MovieClip;
    var antiTankmine_mc:MovieClip;
    var maxHP:int = 100;
    var currentHP:int = maxHP;
    var percentHP:Number = currentHP / maxHP;
    function initialiseMine():void
        minesInGame = 15;
        //create a timer fires every second
        mineMaker = new Timer(6000, minesInGame);
        //tell timer to listen for Timer event
        mineMaker.addEventListener(TimerEvent.TIMER, createMine);
        //start the timer
        mineMaker.start();
    function createMine(event:TimerEvent):void
    //var tankMine_mc:MovieClip;
    //create a new instance of tankMine
    tankMine_mc = new Mine();
    //set the x and y axis
    tankMine_mc.y = 513;
    tankMine_mc.x = 1080;
    // adds mines to stage
    addChild(tankMine_mc);
    tankMine_mc.addEventListener(Event.ENTER_FRAME, moveHorizontal);
    function moveHorizontal(evt:Event):void{
        evt.target.x -= Math.random()*5;
        if (evt.target.x >= stage.stageWidth)
            evt.target.removeEventListener(Event.ENTER_FRAME, moveHorizontal);
            removeChild(DisplayObject(evt.target));
    initialiseMine();
        //declare varibles to create mines
    var atmInGame:uint;
    var atmMaker:Timer;
    function initialiseAtm():void
        atmInGame = 15;
        //create a timer fires every second
        atmMaker = new Timer(8000, minesInGame);
        //tell timer to listen for Timer event
        atmMaker.addEventListener(TimerEvent.TIMER, createAtm);
        //start the timer
        atmMaker.start();
    function createAtm(event:TimerEvent):void
    //var antiTankmine_mc
    //create a new instance of tankMine
    antiTankmine_mc = new Atm();
    //set the x and y axis
    antiTankmine_mc.y = 473;
    antiTankmine_mc.x = 1080;
    // adds mines to stage
    addChild(antiTankmine_mc);
    antiTankmine_mc.addEventListener(Event.ENTER_FRAME, moveHorizontal);
    function moveHorizontal_2(evt:Event):void{
        evt.target.x -= Math.random()*10;
        if (evt.target.x >= stage.stageWidth)
            evt.target.removeEventListener(Event.ENTER_FRAME, moveHorizontal);
            removeChild(DisplayObject(evt.target));
    initialiseAtm();
    function moveForward():void{
        bg_mc.x -=10;
    function moveBackward():void{
        bg_mc.x +=10;
    var tank_mc:Tank;
    // create a new Tank and put it into the variable
    // tank_mc
    tank_mc= new Tank;
    // set the location ( x and y) of tank_mc
    tank_mc.x=0;
    tank_mc.y=375;
    // show the tank_mc on the stage.
    addChild(tank_mc);
    stage.addEventListener(KeyboardEvent.KEY_DOWN, onMovementKeys);
    //creates the movement
    function onMovementKeys(evt:KeyboardEvent):void
        //makes the tank move by 10 pixels right
        if (evt.keyCode==Keyboard.D)
        tank_mc.x+=5;
    //makes the tank move by 10 pixels left
    if (evt.keyCode==Keyboard.A)
    tank_mc.x-=5
    //checking if the space bar is pressed and shooting is allowed
    if(evt.keyCode == 32 && shootAllow){
        //making it so the user can't shoot for a bit
        shootAllow = false;
        //declaring a variable to be a new Bullet
        var newBullet:Bullet = new Bullet();
        //changing the bullet's coordinates
        newBullet.y = tank_mc.y + tank_mc.width/2 - newBullet.width/2;
        newBullet.x = tank_mc.x;
        //then we add the bullet to stage
        addChild(newBullet);
    if (tank_mc.hitTestObject(antiTankmine_mc))
            //tank_mc.gotoAndPlay("hit");
            currentHP -= 10;
            // remove anti tank mine
            removeChild(antiTankmine_mc);
    if (tank_mc.hitTestObject(tankMine_mc))
            //tank_mc.gotoAndPlay("hit");
            currentHP -= 10;
            // remove anti tank mine
            removeChild(tankMine_mc);
        //var maxHP:int = 100;
    //var currentHP:int = maxHP;
    //var percentHP:Number = currentHP / maxHP;
        //Incrementing the cTime
    //checking if cTime has reached the limit yet
    if(cTime < cLimit){
        cTime ++;
    } else {
        //if it has, then allow the user to shoot
        shootAllow = true;
        //and reset cTime
        cTime = 0;
    function updateHealthBar():void
        percentHP = currentHP / maxHP;
        healthBar.barColor.scaleX = percentHP;
        if(currentHP <= 0)
            currentHP = 0;
            trace("Game Over");
        updateHealthBar();

    USe the trace function to analyze what happens and what fails to happen in the code you showed.  trace the conditional values to see if they are set up to allow a shot when you press the key

  • Urgent Help with Image Gallery

    Hi,
    I really need help with an image gallery i have created. Cannot think of a resolution
    So....I have a dynamic image gallery that pulls the pics into a movie clip and adds them to the container (slider)
    The issue i am having is that when i click on this i am essentially clicking on all the items collectively and i would like to be able to click on each image seperately...
    Please see code below
    var xml:XML;
    var images:Array = new Array();
    var totalImages:Number;
    var nbDisplayed:Number = 1;
    var imagesLoaded:int = 0;
    var slideTo:Number = 0;
    var imageWidth = 150;
    var titles:Array = new Array();
    var container_mc:MovieClip = new MovieClip();
    slider_mc.addChild(container_mc);
    container_mc.mask = slider_mc.mask_mc;
    function loadXML(file:String):void{
    var xmlLoader:URLLoader = new URLLoader();
    xmlLoader.load(new URLRequest(file));
    xmlLoader.addEventListener(Event.COMPLETE, parseXML);
    function parseXML(e:Event):void{
    xml = new XML(e.target.data);
    totalImages = xml.children().length();
    loadImages();
    function loadImages():void{
    for(var i:int = 0; i<totalImages; i++){
      var loader:Loader = new Loader();
      loader.load(new URLRequest("images/"+String(xml.children()[i].@brand)));
      images.push(loader);
    //      loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,onProgress);
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete);
    function onComplete(e:Event):void{
    imagesLoaded++;
    if(imagesLoaded == totalImages){
      createImages();
    function createImages():void{
    for(var i:int = 0; i < images.length; i++){
      var bm:Bitmap = new Bitmap();
      bm = Bitmap(images[i].content);
      bm.smoothing = true;
      bm.x = i*170;
      container_mc.addChild(bm);
          var caption:textfile=new textfile();
          caption.x=i*170; // fix text positions (x,y) here
       caption.y=96;
          caption.tf.text=(xml.children()[i].@brandname)   
          container_mc.addChild(caption);

    yes, sorry i do wish to click on individual images but dont know how to code that
    as i mentioned i have 6 images that load into an array and then into a container and i think that maybe the problem is that i have the listener on the container so when i click on any image it gives the same results.
    what i would like is have code thats says
    if i click on image 1 then do this
    if i click on image 2 then do something different
    etc
    hope that makes sense
    thanks for you help!

  • I need help with controlling two .swf's from third.

    Hi, thanks for reading!
    I need help with controlling two .swf's from third.
    I have a problem where I need to use a corporate designed
    .swf in a digital signage solution, but have been told by the legal
    department that it can not be modified in any way, I also can't
    have the source file yada yada. I pulled the .swfs from their
    website and I decompiled them to see what I was up against.
    The main swf that I need to control is HCIC.swf and the
    problem is it starts w/ a preloader, which after loading stops on a
    frame that requires user input (button press) on a play button,
    before the movie will proceed and play through.
    What I have done so far is to create a container swf,
    HCIC_container.swf that will act as Target for the HCIC.swf, and
    allow me to send actionscript to the file I'm not allowed to
    modify.
    I managed to get that done with the help of someone on
    another forum. It was my hope that the following script would just
    start HCIC.swf at a frame past the preloader and play button, and
    just play through.
    var container:MovieClip = createEmptyMovieClip("container",
    getNextHighestDepth());
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener(this);
    mcLoader.loadClip("MCIC.swf", container);
    function onLoadInit(mc:MovieClip) {
    mc.gotoAndPlay(14);
    But unfortunately it didn't solve my problem. Because there
    is a media-controller.swf, that is being loaded by HCIC.swf that
    has the controls including the play button to start HCIC.swf.
    Here's a link to a .zip file with all 3 .swf files, and all 3
    .fla files.
    http://www.axiscc.com/temp/HCIC.zip
    What I need to do is automatically start the HCIC.swf file
    bypassing the pre-loader and play button without editing it or the
    media-controller.swf in anyway. So all the scripting needs to be
    done in HCIC_container.swf.
    I know this is confusing, and its difficult to explain, but
    if you look at the files it should make sense.
    ActionScripting is far from my strong point, so I'm
    definitely over my head here.
    Thanks for your help.

    Got my solution on another forum.
    http://www.actionscript.org/forums/showthread.php3?t=146827

  • Need Help with a Flash Web Project

    Hello, everyone. I am trying to use Flash to make a two-step
    system. I want the flash document to, first, allow a person to
    upload multiple image files and then, second, for the flash
    document be able to create a slideshow with the uploaded images and
    fade in and out from each image until the slideshow is over. I want
    it to be where the flash document creates its own slideshow with
    the images that are uploaded in the first step that I mentioned. I
    want it to do it completely on its own so I need to know how to
    give it the proper AI so that it can do this task.
    So, are there any tips that anyone has on how to do this? Can
    anyone tell me exactly how to do this? I really need help with this
    for my new website project. Thanks in advance, everyone!

    The problem with the text not appearing at all has to do with you setting the alpha of the movieclip to 0%.  Not within the movieclip, but the movieclip itself.  The same for the xray graphic, except you have that as a graphic symbol rather than a movieclip.  To have that play while inhabiting one frame you'll need to change it to a movieclip symbol.
    To get the text to play after the blinds (just a minor critique, I'd speed up the blinds), you will want to add some code in the frame where you added the stop in the blinds animation.  You will also need to assign instance names for the text movieclips in the properties panel, as well as place a stop(); in their first frames (inside).
    Let's say you name them upperText and lowerText.  Then the code you'd add at the end of the blinds animation (in the stop frame) would be...
    _parent.upperText.play();
    _parent.lowerText.play();
    The "_parent" portion of that is used to target the timeline that is containing the item making the command, basically meaning it's the guy inside the blinds telling the guy outside the blinds to do something.
    You'll probably want to add stops to the ends of the text animations as well.
    If you want to have the first text trigger the second text, then you'd take that second line above and place it in the last frame of the first text animation instead of the blinds animation.
    Note, on occasion, undeterminably, that code above doesn't work for some odd reason... the animation plays to the next frame and stops... so if you run into that, just put a play(); in the second frame to help push it along.
    PS GotoandPlay would actually be gotoAndPlay, and for the code above you could substitute play(); with gotoAndPlay(2);

  • Help with adding image onclick

    Hey everyone,
    I am making a simple game in AS3 and need help with adding an image once they have click on something.
    On the left of the screen are sentences and on the right an image of a form. When they click each sentence on the left, writing appears on the form. Its very simple. With this said, what I would like to do is once the user click one of the sentences on the left, I would like a checkmark image to appear over the sentence so they know they have already clicked on it.
    How would I go about adding this to my code?
    var fields:Array = new Array();
    one_btn.addEventListener(MouseEvent.CLICK, onClick1a);
    one_btn.buttonMode = true;
    function onClick1a(event:MouseEvent):void
        fields.push(new one_form());
        fields[fields.length-1].x = 141;
        fields[fields.length-1].y = -85;
        this.addChild(fields[fields.length-1]);   
        one_btn.removeEventListener(MouseEvent.CLICK, onClick1a);
        one_btn.buttonMode = false;
        //gotoAndStop("one")
    two_btn.addEventListener(MouseEvent.CLICK, onClick2a);
    two_btn.buttonMode = true;
    function onClick2a(event:MouseEvent):void
        fields.push(new two_form());
        fields[fields.length-1].x = 343.25;
        fields[fields.length-1].y = -85;
        this.addChild(fields[fields.length-1]);
        two_btn.removeEventListener(MouseEvent.CLICK, onClick2a);
        two_btn.buttonMode = false;
        //gotoAndStop("two")

    I don't know where you're positioning the button that should enable/disable the checkbox but for "one_btn" let's just say it's at position: x=100, y=200. Say you'd want the checkbox to be to the left of it, so the checkbox would be displayed at: x=50, y=200. Also say you have a checkbox graphic in your library, exported for actionscript with the name "CheckBoxGraphic".
    Using your code with some sprinkles:
    // I'd turn this into a sprite but we'll use the default, MovieClip
    var _checkBox:MovieClip = new CheckBoxGraphic();
    // add to display list but hide
    _checkBox.visible = false;
    // just for optimization
    _checkBox.mouseEnabled = false;
    _checkBox.cacheAsBitmap = true;
    // adding it early so make sure the forms loaded don't overlap the
    // checkbox or it will cover it, otherwise swapping of depths is needed
    addChild(_checkBox);
    // I'll use a flag (a reference for this) to know what button is currently pushed
    var _currentButton:Object;
    one_btn.addEventListener(MouseEvent.CLICK, onClick1a);
    one_btn.buttonMode = true;
    function onClick1a(event:MouseEvent):void
         // Check if this button is currently the pressed button
         if (_currentButton == one_btn)
              // disable checkbox, remove form
              _checkBox.visible = false;
              // form should be last added to fields array, remove
              removeChild(fields[fields.length - 1]);
              fields.pop();
              // clear any reference to this button
              _currentButton = null;
         else
              // enable checkbox
              _checkBox.visible = true;
              _checkBox.x = 50;
              _checkBox.y = 200;
              // add form
              fields.push(new one_form());
              fields[fields.length-1].x = 141;
              fields[fields.length-1].y = -85;
              this.addChild(fields[fields.length-1]);
              // save this button as last clicked
              _currentButton = one_btn;
         // not sure what this is
        //gotoAndStop("one")
    I'd also centralize all the click handlers into a single handler and use the buttons name to branch on what to do, but that's a different discussion. Just see if this makes sense to you.
    The jist is a graphic of a checkbox that is a MovieClip symbol in your library exported to actionscript with the class name CheckBoxGraphic() is created and added to the display list.
    I made a variable that points itself to the last clicked button, when the "on" state is desired. If I detect the last clicked button was this button, I remove the form I added and the checkbox. If the last clicked button is not this button, I enable and position the checkbox as well as add the form.
    What is left to do is handle the sitation where multiple buttons are on the screen. When a new button is pushed it should remove anything the previous button added. This code simply demonstrates clicking the same button multiple times to toggle it "on and off".

  • Help with video in Flex - Alternative to embedding .flv?

    I'm building a Flex application that needs to play a video, which I have in .flv format.  I tried the mx:VideoDisplay component, and it was great, but, unfortunately, I need to be able to package the entire application into a single file, and Flex doesn't support embedding .flv files.  Next I tried converting the .flv to a .swf, embedding that, then using mx:SWFLoader to display it.  This worked, except that I can no longer control the video playback; the video just keeps endlessly looping.  I need to be able to stop the video, and ideally I would like access to something like the complete event from mx:VideoDisplay, so that I can hide the video when it has reached the end.
    I have tried a couple of solutions based around the idea that the content of the .swf can be treated as a MovieClip, but none of these worked for me.  Any ideas?

    Hi, Keith Lee -
    I'm sorry that I cannot help with your problem, but I'm posting a few URLs that may perhaps help - 
    Working with video: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e1a.html
    Getting started with stage video: http://www.adobe.com/devnet/flashplayer/articles/stage_video.html
    Stage video articles and tutorials: http://www.adobe.com/devnet/flashplayer/stagevideo.html
    ActionScript reference: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/StageVideo. html
    Thanks,
    Mallika Yelandur
    Adobe Community Help & Learning

  • I need help with a button animation!

    Hi,
    I hope someone can help with a simple-looking problem which
    nonetheless has me stumped!
    I have a feeling that I've missed something obvious.
    I've created a movie clip to act as a button (I've called it
    "abs_button") and placed it on the stage.
    My main movie has one frame.
    Within the "abs_button" movie clip there are 5 layers.
    Labels, actions, default button state, rollover state and rollout
    state.
    Technically, default button state, rollover state and rollout
    state could be on the same layer as they don't overlap, but I've
    given each animation its own layer for clarity.
    FRAME 01.
    Default button state is one frame with a graphic of the
    button. Just a label at the start ("abs_up") and a "stop();" action
    at the end.
    FRAME 02 to 31.
    Rollover state is a 30 frame animation. Label at start
    ("abs_over"), "stop()"; action at the end.
    FRAME 32 to 62.
    Rollout state is a 30 frame animation. Label at start
    ("abs_out"), "stop()"; action at the end.
    All animations were achieved with tweens.
    My initial "abs_button" code:
    on (release) {
    getURL("targetPage.htm", "_self");
    on (rollOver) {
    gotoAndPlay("abs_button", "abs_over");
    on (rollOut) {
    gotoAndPlay("abs_button", "abs_out");
    As it stands, the animation jumps to frame 1 of "abs_out" on
    rollout.
    I need the "abs_over" animation to always play through to the
    end, as the "abs_out" is "abs_over" in reverse (i.e. image grows
    large on rollover and shrinks again on rollout.
    I've tried for 2 days to solve this, but I clearly need help.
    My experiments with variables simply didn't work.
    I would be grateful if someone could tell me where I'm going
    wrong!
    Thanks,
    Andy

    use this:
    on (rollOver) {
    gotoAndPlay("abs_over");
    Since the code is attached directly to the movieclip, you
    don't have to
    identify the clip. A gotoAndPlay() function takes a frame
    number or a
    frame label name as its argument, never the name of the clip
    that
    contains the frame number or name.
    Rob
    Rob Dillon
    Adobe Community Expert
    http://www.ddg-designs.com
    412.243.9119

  • Help with linking buttons to Scenes

    Hey,
    Rookie to Flash and AS3. Just needed some help with my buttons. Im making a flash program about pancakes (random I know). I have a "Mainmenu" scene and then a "Recipe" scene. I have a button on my mainmenu which takes me to the recipe page when I click it, the code behind the button is
    "stop();btn_recipe.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);function mouseDownHandler(event:MouseEvent):void {
    gotoAndStop(1, "Recipe");
    Then when I arrive at my recipe page I have a button which will take me back to my MainMenu, the code behind that button is:
    "stop();btn_home.addEventListener(MouseEvent.MOUSE_DOWN, mouse5DownHandler);function mouse5DownHandler(event:MouseEvent):void {
    gotoAndPlay(1, "MainMenu");
    So I run my program and the first button works and takes me to recipe page but the button to get to the main menu does nothing, click it and no response or anything
    Please help

    First, hopefully having all your code mushed onto the same line is a copy/paste error, otherwise it should look like...
    stop();
    btn_recipe.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    function mouseDownHandler(event:MouseEvent):void {
         gotoAndStop(1, "Recipe");
    If the intention is to click the buttons to make them work, then you should use CLICK instead of MOUSE_DOWN.  MOUSE_DOWN can be a persistent state whereas CLICK involves releasing it afterwards.
    As for the code to get you back home, where is it located on the timeline?  Are you getting any error messages when you try to use it?
    One thing you should learn to use is the trace() function.  It is useful for troubleshooting.  You can use it now to see if your second button is talking to the function at all...
    stop();
    btn_home.addEventListener(MouseEvent.CLICK, mouse5DownHandler);
    function mouse5DownHandler(event:MouseEvent):void {
         trace("the button works okay");
         gotoAndPlay(1, "MainMenu");
    If you don't get that message in the output panel, you'll know the button is not properly coded to work.
    Most folks here will recommend you get away from using scenes in a design that includes navigation--they have a history of being problematic.  Instead of using scenes, divide the one main timeline up into sections or use movieclips for the sections and manage their visibility... or do a bit of both.

  • Help with detecting child video playback end

    I have a flash file that plays multiple videos. I'm trying to
    set it up so that all of the videos are loaded by a second (child)
    swf, imbedded in the first. The first (root) would call the second
    (child) swf, play the video, and at the end of the video, playback
    of the parent swf would resume. I can't seem to figure out how to
    do this. If I try to make a call to the root from the second swf, I
    of course can't because it doesn't know the root exists. The parent
    (root) swf has the following code on the frame that calls the
    child:
    ~~~
    stop();
    var loadVideo:URLRequest = new URLRequest("videoinset.swf");
    var videoLoader:Loader = new Loader();
    videoLoader.load(loadVideo);
    // Identifies which frame to play in inset video
    var vidclip:String = "intro";
    function swfLoaded(myEvent:Event):void {
    stage.addChild(videoLoader);
    var mycontent:MovieClip=myEvent.target.content;
    videoLoader.x = 210;
    videoLoader.y = 150;
    mycontent.gotoAndPlay(vidclip);
    videoLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    swfLoaded);
    ~~~
    How can I tell it that when the child gets to frame(#), to go
    back to the root and resume play?
    I am using netstream to play the videos. There are 6, each
    called by a different frame in the videoinset child swf.
    Thanks for any help with this.

    Any help with this really would be appreciated; if I have not
    explained it clearly enough, by all means please let me
    know.

  • Help with  inital start swf

    Hi this is a problem that still has not been solved. Is there any expert out there that can help with a minor bug?
    I read the names of images from a text file into an array.
    var MyImages:Array = new Array;
    I have an event listener that triggers when this has been done.
    myTextLoader.addEventListener(Event.COMPLETE, ImagesLoaded);
    In the ImagesLoaded function I trace out the first item in the array
    trace(MyImages[0]); // = S_DSC_0106.jpg CORRECT
    I then call loadImage(MyImages[0]) to put up the first image and at the same time start the timer. The reason for this is if the timer is 5 seconds, I would have to wait 5 seconds for the first image. Forcing the first image should get over that problem. When the timer first kicks it will get the second image. My problem is the very first image load fails with: SecurityError: Error #2000: No active security context.
    Even though the trace() has correctly displayed the name of the first image in the array. This is a once off problem. The images carry on in a loop repeating without any problem. The code is displayed below. This problem is only that first image.
    package code
      * MovieSlides :
      * Demonstrates a PPT slide show.
      * See MovieSlides.fla
    import flash.events.*;
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.utils.Timer;
    import flash.net.URLRequest;
    import flash.sampler.NewObjectSample;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    public class MovieSlides extends MovieClip
      var imageLoader1:Loader = new Loader();
      var imageLoader2:Loader = new Loader();
      var myTimer:Timer = new Timer(5000,0);
      var TransissionTimer:Timer = new Timer(10,0); // Will start and stop this
      var myTextLoader:URLLoader = new URLLoader();
      var Counter:int = 0;
      var Dir:String = "MalawiPics/";
      var MyImages:Array = new Array;
      var AlphaValue1:Number = 0.0;
      var AlphaValue2:Number = 1;
      var AlphaStep:Number = 0.01;
      var CurrentPlayer:int = 1;
      var ImageCount = 0;
      public function MovieSlides()
       // constructor code
       myTextLoader.addEventListener(Event.COMPLETE, ImagesLoaded);
       myTextLoader.load(new URLRequest("ImageList.txt"));
       imageLoader1.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);
       imageLoader1.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
       imageLoader2.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);
       imageLoader2.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
       // var link:URLRequest = new URLRequest();
       myTimer.addEventListener(TimerEvent.TIMER, timerListener);
       TransissionTimer.addEventListener(TimerEvent.TIMER,MyAlpha);  
      function timerListener(event:TimerEvent):void
       // trace("Test: " + MyImages[0] + " Counter: " + Counter); //  Test: S_DSC_0106.jpg Counter: 0 OK!
       // Then I get SecurityError: Error #2000: No active security context. From where?
       loadImage(Dir + MyImages[Counter]);
       Counter++;
       if(Counter > ImageCount -1) // I only have 16 images in array
        Counter = 0;
      function loadImage(url:String):void
       if(CurrentPlayer == 1)
         imageLoader1.load(new URLRequest(url));
       if(CurrentPlayer == 2)
        imageLoader2.load(new URLRequest(url));
       if(CurrentPlayer == 1) // Toggle loaders 1 and 2
        CurrentPlayer = 2;
       else
        CurrentPlayer = 1;
      function imageLoading(e:Event):void
       // trace("Image now loading ...");
      function imageLoaded(e:Event):void // Shared by both Loaders
          if(CurrentPlayer == 2) // For player 1 has been ++
        AlphaValue1 = 0.0;
        AlphaValue2 = 1.0;
        imageLoader1.alpha = AlphaValue1;
        imageArea1.addChild(imageLoader1);
       else
        AlphaValue1 = 1.0;
        AlphaValue2 = 0.0;
        imageLoader2.alpha = AlphaValue2;
        imageArea2.addChild(imageLoader2);
       TransissionTimer.start();
      function MyAlpha(event:TimerEvent):void // TransissionTimer
       if(CurrentPlayer == 2)
        AlphaValue1 += AlphaStep;
        AlphaValue2 -= AlphaStep;
        //trace("AlphaValue1 " + AlphaValue1);
        imageLoader1.alpha = AlphaValue1;
        imageLoader2.alpha = AlphaValue2;
        if(imageLoader1.alpha == 1)
         TransissionTimer.stop();
         imageLoader1.alpha = 1;   
       if(CurrentPlayer == 1)
        AlphaValue1 -= AlphaStep;
        AlphaValue2 += AlphaStep;
        imageLoader1.alpha = AlphaValue1;
        imageLoader2.alpha = AlphaValue2;
        if(imageLoader2.alpha == 1)
         TransissionTimer.stop();
         imageLoader2.alpha = 1;   
      function ImagesLoaded(e:Event):void
       MyImages = e.target.data.split(/\n/);
       for (var i=0;i<MyImages.length;i++)
       MyImages[i]=MyImages[i].substring(0,MyImages[i].length-1);
       ImageCount = MyImages.length -1; //Thinks there is one more !
       trace(MyImages[0]); // = S_DSC_0106.jpg CORRECT
       // trace(MyImages.length); // 5 WRONG
       loadImage(MyImages[0]); // seems too early
       // SecurityError: Error #2000: No active security context.
       // loadImage("MalawiPics/S_IMGP0993.jpg"); // Malcolm's passport
       myTimer.start();

    you have an incorrect file path/name.
    trace its name and its length to see if it matches your uploaded file path/name.  and, make sure you're using an url-safe path/name.

  • I need help with animation with progress bar.

    Hi,
    I need some help with creating something similar to this site (window opening animation with scrub bar):
    http://www.drutex.pl/pl/oferta/okna/okna-pvc/okna-pvc-iglo-5.html
    I'm kinda new to flash and all so some tutorials for such thing would be helpful.
    Thanks in advance
    Oscar

    What this will involve is a movieclip/timeline containing images showing the sequence of the motion (like the frames of a movie film) and a Slider component that changes the frame of that movieclip/timeline based on its position.
    Here is a link to an Actionscript 3 sample file that demonstrates a Slider providing the control of the timeline...
    http://www.nedwebs.com/Flash/AS3_Slider.fla
    You could edit the looks of the Slider component if you like by doubleclicking it and the inner parts you want to modify, or you could create one of your own if you have enough know-how to code it to work.

Maybe you are looking for