dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: control movieclip from button in another movieclip

  1. #1
    Junior Member
    Join Date
    Jul 2005
    Posts
    8

    control movieclip from button in another movieclip

    I've been searching and searching for the answer to this newbie problem, but I can't find it, so I hope someone won't mind pointing me in the right direction.

    I have 5 buttons within movieclip (1); movieclip (1) is located on the main timeline. I'm trying to get the buttons to jump to a certain frame of movieclip (2) which is also located on the main timeline.
    The code I've been using for, say, the first button is:

    Code:
    Code:
    on (release) { _root.mainwindow_rooms.gotoAndPlay("lounge"); }
    "mainwindow_rooms" is both the library name and the linkage identifier of movieclip (2). It doesn't have an instance name on the stage (is that relevant?)

    I can't get this to work. Can someone please help me with this? I have no idea what I'm doing wrong, I'm not very good with Flash.

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Without a instance name Flash can not target the movieclip, its like it is unnamed.

    Youre code is correwct, you only have to give the movieclip the instance name of mainwindow_rooms

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Junior Member
    Join Date
    Jul 2005
    Posts
    8
    Thanks for the reply.

    I tried what you said but it still wouldn't work. After a bit of searching I tried using the tellTarget method, but I couldn't get that to work, either.
    I tried to upload the .fla in a .zip but it's too large by a little so I've hosted it elsewhere. If anyone has the time to look at it and make corrections/suggestions, I'd be very grateful.

    *file removed*

    Thanks

    Lee
    Last edited by lee cassidy; 07-07-2005 at 08:26 PM.

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Its your buttons that are not working ( the invisible ones ), not the code. You can not use a button for the hit state of another button. Use a simple shape instead.

    Also your framelabel is "bedroom", but in youre button you are targeting "bedrooms".

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  5. #5
    Junior Member
    Join Date
    Jul 2005
    Posts
    8
    I tried what you suggested pellepiano but it still didn't work. It did work after I instance-named every occurrence of mainwindow_rooms on the stage (and fixed the label-name inside the clip...thanks). "mainwindow_rooms" appears on the stage and has a tween happen to it before it's properly visible, so a instance named "mainwindow_rooms" on the keyframes it appears, too.

    So I made a new invisible button and used a basic shape for the hit state. It now works, it makes "mainwindow_rooms" jump to the frame label I want, and I can now repeat that with each instance of the button for all 5 buttons (which are actually movieclips with an invisible button on them for rollover and rollout animations).
    The problem is now that, with the new invisible button on top of the movieclips, the button works fine, but the animation in the movieclip beneath doesn't play when you rollover or rollout.
    Last edited by lee cassidy; 07-07-2005 at 11:12 AM.

  6. #6
    Junior Member
    Join Date
    Jul 2005
    Posts
    8
    Ahh, I fixed it. I simply added the code for targeting the "mainwindow_rooms" movieclip on the same invisible button that's used in each movieclip that functions as a button. Just gave each instance of that invisible button an instance name, and voila!

    Thanks for your help, pellepiano!
    My excellent signature!

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