A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: if statement for loaded swf

  1. #1
    Member
    Join Date
    Jun 2004
    Posts
    32

    if statement for loaded swf

    Hey...I thought I got it, but maybe I don't. I have an empty movie clip called HERE. I have a movie clip with a var name of LOADSTUFF when clicked loads a swf into the empty movieclip so it looks like this.

    loadstuff.onRelease = function() {
    loadMovie("external.swf", _root.here);
    }


    Now..I want to affect other changes once the above condition has been met,lets say i want to play an animation thats held within the loadstuff_mc, but I cannot figure out how to do an if statement for it. I had one, I thought it worked...but it didnt.

    How is an if statement written for this? I thought it was something like...

    if (_root.here = "external.swf"){
    loadstuff.play;
    }


    This is simpel, but for some reason my brain isn't working it out. Please help. thanks.

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    you should get into the habit of using MovieClipLoader object for loading external assets, especially if it is important for you to know when the loading of the external swf, image has completed or yif u want to create a preloader showing the progress of the loading.


    Code:
    var mclListener:Object = new Object();
    var myMCL:MovieClipLoader = new MovieClipLoader();
    myMCL.addListener(mclListener);
    
    
    mclListener.onLoadInit = function():Void{
    	//now we know the swf has been loaded and is ready to use
    	loadstuff.play();
    }
    myMCL.loadClip("external.swf", _root.here);
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    Member
    Join Date
    Jun 2004
    Posts
    32
    thanks weed...

    I'm still a little confused though...i hope a follow-up is okay.
    The file I am working with is kind of big so I am attaching a smaller kind of version of it. I wanted each of the options to play, load an external swf and when that option was selected I didn't want the user to be able to choose again.

    Then when the other options was clicked, it would play the other movieclip from frame 7 to the end.

    So when a user clicks "diary", the line_mc plays, indicating where the user is and loading the diary.swf into the empty movieclip. Once the user clicks on "icons" the rest of line_mc would play, retracting the line and making "diary" a viable option again, while also drawing the line for "icons" and loading the external swf. The final version will have about 4 of these type of things. I sort of understand the help you've given me, but not how to expand it because as is it sort of autoplays the external swf.

    ANY more helpw ould be much appreciated.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center