A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: combining properties?

  1. #1
    Breakfast of Champions
    Join Date
    Nov 2004
    Posts
    85

    combining properties?

    is there a way to combine two actions in a single line? for example, i have:

    PHP Code:
    _root.pack9.enabled=false;
    _root.pack9._visible=false
    how can i assign the _visible and .enabled parameters in a single line so i can cut down on the amount of code i use? is there a way?
    Mindsucker

  2. #2
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,145
    I think you only need to set _visible property. It will hide the clip and no buttons in the clip will work.

    If you're asking how to reference clips dynamically, you can reference clips like this:

    var myNumberVar:number = 9;
    _root["pack" + myNumberVar]._visible = false;

    You can share code in a loop or function:

    function hideClip(passNumber){
    _root["pack" + myNumberVar]._visible = false;
    }

    Then just call the function:

    hideClip(9);

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