A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: setting an MC Instance as a variable

  1. #1
    smell me?
    Join Date
    Sep 2000
    Location
    [Little Rock] Arkansas.USA
    Posts
    50
    Is there a way to set a MC Instance as a global variable so that you can pass that variable to a reusable MC???


    -relm

    [swf width="300" height="40" background="#000000"]http://relmone.com/flash/footer.swf[/swf]

  2. #2
    Member
    Join Date
    Jul 2000
    Posts
    34
    Hi relm...

    I don't really understand what your trying to accomplish. Could you give more details?

    Corey

  3. #3
    smell me?
    Join Date
    Sep 2000
    Location
    [Little Rock] Arkansas.USA
    Posts
    50

    Figured Out......

    This is something that will help a lot on file size if you plan to reuse MCs that will affect another MC.

    Basically what i did was Create a Virtual Room Designer where you can add objects such as Dressers, Armoires, Chairs, Sofas, etc.............

    When you add an element (chair, dresser, etc.) you have the ability to remove the item or rotate the item 360 degrees in 15 degreee increments. There is a seperate MC that controls all of this (rotate and remove functions).

    What i was wanting to do is when you roll over the particular item (chair, sofa, etc.) it will pass a variable to the MC that controls the rotation and removal. That way only this one MC was needed and not one MC for every item on the stage.

    Below is the ActionScript for this:::::::::::::::::

    AS for the ITEMS ::::

    on (rollOver) {
    tellTarget ("_root.rotate_delete") {
    gotoAndStop (2);
    item = _root.item_chair;
    }
    }
    on (press) {
    startDrag (this);
    }
    on (release) {
    stopDrag ();
    }


    AS for the Reusable ROTATE AND DELETE MC:::::::::::
    ROTATE BUTTON ::::::::::::
    on (release) {
    setProperty ("item", _rotation, (getProperty (item , _rotation)) + 15);
    }

    REMOVAL BUTTON:::::::::::
    on (release) {
    setProperty ("item", _rotation, (getProperty (item , _rotation)) + 15);
    }


    hope ths makes sense to everyone.........if not then email me and i will try to send an example file.........

    -relm

    "sharing knowledge is REAL POWER!!!!!!!!!"


    [swf width="300" height="40" background="#000000"]http://relmone.com/flash/footer.swf[/swf]



  4. #4
    You may want to look into using the "function" command in a master MC. Then you can just call the function with out all the tellTarget stuff. It make like easier.

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