A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: _visible = false?

  1. #1
    Member
    Join Date
    Feb 2002
    Posts
    67
    O.k this is what I want to happen... I load a swf into my main scene with loadMovieNum, name.swf, 1); And I added _visible = false on frame 1 of name.swf. So what I want is to click on a button within the main movie and have it bring the loaded movie into view with _visible = true, but then also make that loaded movie jump to frame 2 and play.
    How would I do that. It's probably simple and I am having a brain fart, so please bear with me.

    Thanks in advance, william

  2. #2
    Senior Member
    Join Date
    Jun 2001
    Posts
    2,943
    This should work:
    Code:
    on(release){
    setProperty("clipname",_visible,true);
    clipname.gotoAndPlay(2);
    }
    It would probably have been better practice to set the visibility from the main movie rather than from within the loaded one.

    Also, remember that _visble = false is different to alpha = 0%.

  3. #3
    Member
    Join Date
    Feb 2002
    Posts
    67

    I can't get that to work

    O.K, This is on the button

    on(release){
    setProperty("menu.swf",_visible,true);
    menu.gotoAndPlay(2);
    }
    This is on frame 1 of main movie

    loadMovieNum ("menu.swf", 1);

    This is on frame 1 of menu.swf

    _visible = false;

    And I have a stop action on frame 1 and the last frame of the menu swf.

    Can some one tell me what I am doing wrong?
    Thanks for the help Sualdam

  4. #4
    Senior Member
    Join Date
    Jun 2001
    Posts
    2,943
    A bit of confusion - not helped by me

    A bit of basic stuff.

    You can load a movie into a level (as you have done, and which I didn't realise even though you said that in your first post), or you can load it into a clip (which I assumed you had done, even though you clearly said you hadn't).

    The code I gave assumes that you have a movie clip on the stage called 'clipname'.

    'clipname' is an instance name - not the library name or the name of the external file. You give a clip an instance name in the Instance panel.

    If that was the situation in your movie, what I said would have worked.

    Fortunately, you only need a minor change to make it work in your case.

    As you can see from the above, you need to address a loaded movie using a different name to any of the others you have already given it. The name can be the same as the other names (clip.swf, clip (in the library), or clip (instance name)).

    In your case, the 'name' is the level you have loaded it into, so alter the code slightly like this:
    Code:
    on(release){
    setProperty("_level1",_visible,true);
    _level1.gotoAndPlay(2);
    }
    That should work now.

    What you tried - well, from what I said above you can see that 'menu.swf' isn't how you talk to a loaded movie.

    Sorry about that confusion.

    And like I said in my first post, you'd be better off putting the _visible = false part in the main movie if you can. It will be easier to debug in future because everything will be in one movie (the main one), and in six months time when you have forgotten how you did it it will be easier to remember what you did.

  5. #5
    Member
    Join Date
    Feb 2002
    Posts
    67

    Hmmm

    Well I still can't get it to work
    Maybe you would want to look at the files, if so here they are,

    http://www.ibrake4storms.com/flash/index.swf
    http://www.ibrake4storms.com/flash/index.fla

    and the loaded menu file,

    http://www.ibrake4storms.com/flash/menu.swf
    http://www.ibrake4storms.com/flash/index.fla

  6. #6
    Senior Member
    Join Date
    Jun 2001
    Posts
    2,943
    You've done this in Flash MX, haven't you?

    Glances up at the forum title to make sure he hasn't gotten lost - yup! Flash 5 Actionscript

    I use Flash 5 and cannot open MX files.

  7. #7
    the usual
    Join Date
    Jul 2000
    Posts
    1,482
    should we not be teaching flash 5 actionscripting?

    Code:
    on(release){
    level1._visible = true
    _level1.gotoAndPlay(2);
    }

  8. #8
    Member
    Join Date
    Feb 2002
    Posts
    67

    bummer

    Well the reason I used this forum is that I was thinking it was an Actionscript problem and there's no mx actionscript forum here at least I can't find it, so, I guess it's up to me, look out world
    If you want me to I'll post all the script's and where they are located within the movie, it's kinda lamb but I don't know what else to do.

    Thanks anyway, william

  9. #9

  10. #10
    Senior Member
    Join Date
    Jun 2001
    Posts
    2,943
    SetProperty is Flash 5 syntax.

    It isn't deprecated (yet) and it is clearer for new users.

    Dot syntax is fine, of course, but it can cause confusion because it is effectively shorthand.

    SetProperty arguably lets people see what they are doing when they are unfamiliar with things.

    For one thing, mentioning it here and now hasn't helped solve this problem and the use of setProperty hasn't added to it

  11. #11
    the usual
    Join Date
    Jul 2000
    Posts
    1,482
    Sualdam -

    setProperty is noted as flash 4 syntax!

    as you probably know nothing has actually been depreciated as the new flash player supports all syntax (flash 4 and flash 5), however it is recognised that there is new methods of writing flash 4 syntax in flash 5, its not shorthand it is simply another way of writing it

    if you have not used flash 4 and you started with flash 5 - if you were to pick up a actionscripting book it would teack you that we write

    _root.visible = true // or 1

    then underneath it would state the flash 4 syntax

    now if a new user is looking through soource code how are they going to understand what it means if it's in F5 syntax when people in the Flash5 AS forum are teaching the wrong (less used syntax?)

    .... and yes i know it has not helped the problem but i feel that if you are intent on teaching, what is cassed as flash4 code it should be made clear that there are other ways of writing it and as you stated

    Glances up at the forum title to make sure he hasn't gotten lost - yup! Flash 5 Actionscript
    .. however i can't see whay the code does not work/give desired effect!

  12. #12
    Senior Member
    Join Date
    Jun 2001
    Posts
    2,943
    I take your point, but - for example - neither the (useless) Flash 5 Bible nor the (excellent) Macromedia Flash 5 Advanced state either that setProperty is deprecated or Flash-4-only syntax.

    I've not seen any other book or reference describe it that way.

    The latter book uses setProperty as its primary syntax. It emphasises the use of dot syntax over slash syntax. It states clearly that dot syntax replaces slash syntax in previous versions of Flash.

    Indeed, one might need to be careful using dot syntax if older players involved - I'm not sure about that though.

    Most significantly, it describes the dot notation in this context as 'an alternative way of setting movie-clip properties'. It doesn't say it is the preferred way, or the new way, or the only way. Just an alternative one.

    Personally, if it were incorrect syntax I wouldn't use it.

    Actually, I use the dot syntax most of the time in my own movies for brevity, but I always use setProperty when I'm explaining something - so that people know they are actually setting a property. Dot syntax doesn't emphasise that fact to new users.

    But it isn't the wrong syntax.

  13. #13
    the usual
    Join Date
    Jul 2000
    Posts
    1,482
    lets see [from actionscript the definitive guide]

    ---------------
    getProperty() Global Function

    availibility: Flash 4; depreciated in flash 5
    ---------------

    setProperty() Global Function

    availibility: Flash 4 and later

    .... in flash 4, setProperty() was the only means to assign movie clip propertyvalues; as of flash 5, the . and [] operators are the preferred means of setting noth built-in and custom movie properties.

    // flash 4 syntax
    setProperty("_root",_rotation,45)

    // flash 5 syntax
    _root._rotation = 45
    ---------------
    please note - i did not say it's the wrong syntax but - "should we not be teaching flash 5 actionscripting?"

    it just makes more sence to me if we teach what is considered to be flash5 syntax in the flash5 forum

  14. #14
    Senior Member
    Join Date
    Jun 2001
    Posts
    2,943
    From the horse's mouth:

    http://www.macromedia.com/support/fl...tproperty.html

    It is not deprecated. Not even in MX.

    Macromedia says when a function is deprecated (e.g.):

    http://www.macromedia.com/support/fl...elltarget.html

    Can I just suggest we leave it at that, rather than dig for other contrary statements?

    There was no real reason for bringing it up and - like I said - it has not added/subtracted one iota to the original poster's problem.

    If any new users are reading they're probably confused.

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