A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: Continuous event with button/MC

  1. #1
    Still a newbie at heart
    Join Date
    Mar 2004
    Posts
    184

    Continuous event with button/MC

    Hiya, quite a simple yet confusing (for me) question:

    I have a button which I am using to move an MC down the screen until it hits a certain point.

    The current code i'm using is the standard
    PHP Code:
    on (press
    code which isnt doing too great since it needs constant clicking to move the MC continously.

    I am aware of
    PHP Code:
    onClipEvent (mouseDown
    code but i can't figure how to get it working properly.

    This is what i have at the moment:

    PHP Code:
    on (press) {
        if (
    content._y>=-154.5) {
            
    content._y content._y-10;
        }
        
    trace(_root.content._y);

    This works fine, but I need something that will move the MC continuously until the mouse button is released. Could someone help please?
    Last edited by Pure_5aban; 07-18-2006 at 09:21 AM.
    **Using Flash 8**
    ---------------------

  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Code:
    on(release){
    	_root.content.onEnterFrame = function() {
    	if(_root.content._y == -154.5){
    		_root.content.stop();
    	} else {
    	_root.content._y == _root.content._y--;
    	}
    }
    }

  3. #3
    Still a newbie at heart
    Join Date
    Mar 2004
    Posts
    184
    Hmmm that didn't work
    **Using Flash 8**
    ---------------------

  4. #4
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Works for me.

  5. #5
    Still a newbie at heart
    Join Date
    Mar 2004
    Posts
    184
    can i just confirm that this code is placed on the button right?
    **Using Flash 8**
    ---------------------

  6. #6
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Yes, it goes on the button, and whatever your moving needs to have the instance name of content.
    Attached Files Attached Files

  7. #7
    Still a newbie at heart
    Join Date
    Mar 2004
    Posts
    184
    yup its all correct... i've put the code on the button & the MC to be moved is named content. still doesnt work though. I'm using MX2004 will that make any difference?
    **Using Flash 8**
    ---------------------

  8. #8
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Did the one I attached work?

  9. #9
    Still a newbie at heart
    Join Date
    Mar 2004
    Posts
    184
    it works fine on your file but when i apply the same code to an MC in my file it won't work
    **Using Flash 8**
    ---------------------

  10. #10
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Sounds like a path problem. Is content on the root timeline? Or inside another movie clip?

  11. #11
    Still a newbie at heart
    Join Date
    Mar 2004
    Posts
    184
    its nested.... within one other MC, so on the main timeline there is a MC called "about" which contains both the button & "content" MC
    **Using Flash 8**
    ---------------------

  12. #12
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Then the path is wrong, it should be _root.about.content......

    In the button code, select _root.content and click on that little Target Icon in the top bar of the actions panel. Find the content mc and then click OK, flash will write the correct path for you.

  13. #13
    Still a newbie at heart
    Join Date
    Mar 2004
    Posts
    184
    Thats so strange, i understand the logic behind it so theoretically it should work but even after putting the absolute path in it still doesnt work.

    thats odd
    **Using Flash 8**
    ---------------------

  14. #14
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Try the code I posted in post #2, but change the _root words to _parent. that will make it Relative targetting.

  15. #15
    Still a newbie at heart
    Join Date
    Mar 2004
    Posts
    184
    NOPE!!!! still not working.

    i changed it to parent, still not doing anything! the silly thing is EVERYTHING is correct, all the instance names, all the paths everything
    **Using Flash 8**
    ---------------------

  16. #16
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Try attaching the fla so someone can look at it.

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