A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: Targetting a movieclip inside a movieclip (not related to the thread below)

  1. #1
    -i11.5Ki113D- jerryCLEMENT's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, CA
    Posts
    248

    Targetting a movieclip inside a movieclip (not related to the thread below)

    Hi all,

    It's been a while since i've done any flash work and i have run into a snag.

    I am trying to target a movieclip (a button) that is inside another movie clip.
    Basically you roll over a circle, the circle expands and reveals buttons. Targetting the buttons inside the movie clip circle is giving me problems.

    I am using CS3, but i have AS set to 2.0.

    For a visual here...

    _root
    "navigation"
    "home"

    Basically trying to target "home" from _root for an onRollOver command. Have tried this code

    Code:
    _root.navigation.onRollOver = function() {
    	_root.navigation.gotoAndPlay(1);
    }
    and many variations.

    Why isn't this working for me?

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Is it a real Button or a movieclip you use as a button?
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    -i11.5Ki113D- jerryCLEMENT's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, CA
    Posts
    248
    Movieclip being used as a button. Don't think i have ever used an actual button.

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Did not look at your code so precisely

    _root.navigation.onRollOver = function() {
    this.gotoAndPlay(1);
    }
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    -i11.5Ki113D- jerryCLEMENT's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, CA
    Posts
    248
    bah, didn't even notice that i wrote the code wrong above.

    the path to the MC im trying to get to is

    Code:
    _root.navigation.home
    What would be the reason for using "this"?

    Code:
    _root.navigation.home.onRollOver = function() {
    this.gotoAndPlay(1);
    }
    Should it be like that?

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    "this" within the function refers to _root.navigation.home.
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    -i11.5Ki113D- jerryCLEMENT's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, CA
    Posts
    248
    Thanks will try this when i get home.

  8. #8
    -i11.5Ki113D- jerryCLEMENT's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, CA
    Posts
    248
    "this" doesn't work. I am posting just the navigation movieclip that i am having issues with. The only code i have on there is the inital mask animation (the expand). What i am trying to do is get the rollover and rollout command to work for the buttons (which are movieclips) inside this clip.

    Also there is a bug when you drag the mouse straight down or across that gets the growing and shrinking stuck in a loop. I think this is caused by the shape hitting a point where it is trying to rollover and rollout at the same time.

    I could only save it down to Flash 8 (which i guess doesn't really matter here since this is a CS3 forum) and i set it to AS 2 (or 1 i forget) for lower versions. I will ultimately be using it in AS 2.

    Thanks a bunch for looking at this. I really can't think of why this is happening. Maybe i am missing something inane.
    Attached Files Attached Files

  9. #9
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You cannot have a button event inside of a button. That is only possible with Actionscript 3.
    - The right of the People to create Flash movies shall not be infringed. -

  10. #10
    -i11.5Ki113D- jerryCLEMENT's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, CA
    Posts
    248
    How would i go about this in AS3? Any code you can point me to to check out?

    Also you know that i am not using actual buttons i assume. By button events do you mean rollovers and things like that?

  11. #11
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,136
    uh, well I can immediately tell from your code that you should be telling your nav to gotoAndPlay(2) , not frame 1, that's why you're getting the nasty flicker.

  12. #12
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Here you can see how to separate button events:
    http://flashas3.flashscript.biz/mouse/button_event.html
    - The right of the People to create Flash movies shall not be infringed. -

  13. #13
    -i11.5Ki113D- jerryCLEMENT's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, CA
    Posts
    248
    Quote Originally Posted by joshstrike
    uh, well I can immediately tell from your code that you should be telling your nav to gotoAndPlay(2) , not frame 1, that's why you're getting the nasty flicker.

    It's still happening even when changed to 2. It's not as bad, but it is still flickering.

  14. #14
    -i11.5Ki113D- jerryCLEMENT's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, CA
    Posts
    248
    Quote Originally Posted by cancerinform
    Here you can see how to separate button events:
    http://flashas3.flashscript.biz/mouse/button_event.html
    Thanks cancer. I'm gonna take a look at this and see if i can try and learn it.

    If i end up using AS3 for this navigation I have to use it throughtout the site right? I can't mix AS2 and 3?
    Last edited by jerryCLEMENT; 06-23-2007 at 08:04 PM.

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