A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: How to Toggle loaded SWF visible/invisible??

  1. #1
    Junior Member
    Join Date
    Oct 2001
    Posts
    21

    How to Toggle loaded SWF visible/invisible??

    Hi,

    I have a site consisting of a number of SWF's layered on top of one another. The bottom SWF (level0) contains most of the navigation and background for the site. I'd like to be able to control the visibility of some of the SWFs on top of level0 by various navigational choices from various other levels.

    In other words, A mouseclick in level 6, should make level3 beneath it invisible, then, maybe later, another navigational choice should make level 3 visible again, without having to load and unload movies all the time.

    If anyone could give me some help with scripting this, I'd be very grateful.

    thank you,

    Ben

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    _level3._visible=0;//makes it invisible
    _level3._visible=1;//makes it visible
    gparis

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    218
    I thought it was a boolean:

    instanceName._visible = false;
    instanceName._visible = true;

    Is this not correct?

  4. #4
    primate with a keyboard
    Join Date
    Mar 2001
    Location
    The Netherlands Mood: happy monkey :-D Likes: you know... |:-) Dislikes: stupid stuff
    Posts
    72
    0 = false
    1 = true

    it's the same
    sig? I don't have a sig. euhm.. no wait! this is IT!

  5. #5
    Senior Member
    Join Date
    Jul 2000
    Posts
    218
    Personally to make my code more understandable I use true/false for booleans, but yeah, you're right.

  6. #6
    Senior Member
    Join Date
    Oct 2002
    Location
    belgium
    Posts
    611

    unload probs.Help needed

    Hi there,

    I have problems unloading external files into level1.
    The button that should unload the external file is placed inside an mc and the mc placed on the scene.It's a button that ones is hit keeps in frame 2 of an mc.
    So to unload I gave the code inside the mc on the button.

    on(release){
    _parent.unloadMovieNum (1);
    }

    Is this wrong code?

    I also won't to hide a holder to make the loaded swf on that holder not visible.

    Again this is a button inside an mc.The holder is placed on the scene.

    To do this I did the following.

    on(release){
    _parent.holder._visible = false;
    }

    Also bad code?

    Someone can help out on these probs.Big thx in advance

    Grtz,

    Modulater

  7. #7
    Senior Member
    Join Date
    Jul 2000
    Posts
    218
    I had the same problem, and began loading external mcs into target clips instead of levels. Doing it with levels is a pain in the ass.

    Try createEmptyMovieClip, followed by either loadMovie or attaching from the library. That way you can use unloadMovie instead of unloadMovieNum. For some reason I've just found this way cleaner.

    As for toggling the clip's visibility, mcName._visible = false is correct. Try trace statements like trace(typeof mcName) to verify your movie is there and that it's a movieclip. It may be some other datatype.

    Some sample code:

    Code:
    // Create empty clip on level 0
    _root.createEmptyMovieClip("clip", 0);
    trace("clip is type: " + typeof clip);
    
    clip.createEmptyMovieClip("target", 0);
    trace("target is type: " + typeof target);
    
    // Load external swf into the target
    clip.target.loadMovie("fileNme.swf");
    
    // Now you can adjust properties as you see fit
    clip.target._visible = false;
    trace(clip.target._visible);

    hth,

    Mike

  8. #8
    [sleep.less.ness] euphoricGenius's Avatar
    Join Date
    Jan 2003
    Location
    insomnia
    Posts
    344
    you can always use swapDepth() to change it then remove it dynamically.


    eG
     Beware Of Programmers Who Carry A Screwdriver

  9. #9
    Senior Member
    Join Date
    Jul 2000
    Posts
    218
    It quickly becomes a pain to keep track of the depths.

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