Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-22-2006, 02:09 PM   #1
bunsco
Registered User
 
Join Date: Oct 2006
Posts: 7
Default Event triggered by MC mouse click problem

Hi all

I have a problem that i just cant work out, but am convinced is pretty simple to accomplish.

What im trying to do is to get a MC (test) to animate when i click a MC (nubo) with an onRelease function.

the MC buttons code is set withing a frame script on the main timeline like so:
nubo.onRelease = function ()

The target MC (test) has code within it that tells it to animate to a designated position:
onClipEvent (enterFrame) {
speed = 5;
if (this._y > 110) {

this._y -= speed;
} else {
this._y = 110
}
}


Of course it cannot be achieved using the above onClipEvent - that was solely to get the MC to move the way i intend it to move when it gets the message from the nubo MC.

And there lays the problem - how do i write the code that the target MC activates the code on/within it when i click the nubo MC.

This does not appear to be the most complicated thing to do in Flash, far from it - it appears (to my primative knowledge) to require some kind of conditional referencing i.e:
if the nubo MC is clicked then * = true, which activates the relavent code on the test MC which is dependant on a kind of: if * == true then activate my own motion code.


if that makes any sense.

i'm not versed in the way of listeners, so i have'nt tried that (or know how to).

can someone be so kind as to provide the framework or structure i need to create to accomplish my goal

i have been away from flash for a good year or so, so be very easy on me.

many thanx to all that can help
bunsco is offline   Reply With Quote
Old 10-22-2006, 02:19 PM   #2
anonymous
Banned by AS.org Staff
 
Join Date: Oct 2006
Posts: 1,524
Default

ActionScript Code:
var somevariable:Boolean = false; nubo.onRelease = function (){     _level0.somevariable = true; }; onClipEvent (enterFrame) {     if(_level0.somevariable){         speed = 5;         if (this._y > 110) {             this._y -= speed;         } else {             this._y = 110         }     } }

Last edited by anonymous; 10-22-2006 at 02:21 PM.
anonymous is offline   Reply With Quote
Old 10-22-2006, 02:40 PM   #3
bunsco
Registered User
 
Join Date: Oct 2006
Posts: 7
Default

Quote:
Originally Posted by anonymous
ActionScript Code:
var somevariable:Boolean = false; nubo.onRelease = function (){     _level0.somevariable = true; }; onClipEvent (enterFrame) {     if(_level0.somevariable){         speed = 5;         if (this._y > 110) {             this._y -= speed;         } else {             this._y = 110         }     } }
sorry, but all thats done is to throw up numerous errors - dont know why, but that looked like that should do it
bunsco is offline   Reply With Quote
Old 10-22-2006, 02:43 PM   #4
anonymous
Banned by AS.org Staff
 
Join Date: Oct 2006
Posts: 1,524
Default

Attach your .fla.
anonymous is offline   Reply With Quote
Old 10-22-2006, 02:49 PM   #5
bunsco
Registered User
 
Join Date: Oct 2006
Posts: 7
Default

Quote:
Originally Posted by anonymous
Attach your .fla.
how do i do that? note: im on a mac and the attach bit looks as though it does'nt accomidate fla files.
bunsco is offline   Reply With Quote
Old 10-22-2006, 02:54 PM   #6
pixelwit
village halfwit
 
pixelwit's Avatar
 
Join Date: Jul 2001
Location: USA, PA
Posts: 3,330
Default

Zip it then attach it.

-PiXELWiT
http://www.pixelwit.com
__________________
There are no answers, only choices.
pixelwit is offline   Reply With Quote
Old 10-22-2006, 02:58 PM   #7
bunsco
Registered User
 
Join Date: Oct 2006
Posts: 7
Default

Quote:
Originally Posted by anonymous
Attach your .fla.
sorry, just me being a duh brain, attached fla via zip.
Attached Files
File Type: zip problem fla.zip (243.1 KB, 120 views)
bunsco is offline   Reply With Quote
Old 10-22-2006, 03:20 PM   #8
bunsco
Registered User
 
Join Date: Oct 2006
Posts: 7
Default

this is ultimately tweeked code based on a tutorial from a couple years back.

my ultimate intent is to house the two scrolling buttons into the test MC so when a user first gets to the page, the navagation becomes a little bit more easier to understand.

as it stands now, the navagation on this section just doesnt work i.e: having to include instructions on how to navagate - the ultimate no-no.

you can see how it is at the moment:

www.djtakemura.com (works link) to see what i mean.

im sure if this was to be done again, it could be made much more simply.
But i have'nt the time at the moment so i have to make besst use of what i have.
bunsco is offline   Reply With Quote
Old 10-22-2006, 03:29 PM   #9
anonymous
Banned by AS.org Staff
 
Join Date: Oct 2006
Posts: 1,524
Default

Ummmmmmmmmmh!
Was getting the same kind of errors, but I cleared your code and retyped it and it works fine now...

You do have to use _level0.myBoolean though not only myBoolean and your else is (at the moment) useless...

ActionScript Code:
onClipEvent(enterFrame){     if(_level0.myBoolean){         speed = 5;         if(this._y > 110){             this._y -= speed;         //}else{             //this._y = 110;         }     } }
anonymous is offline   Reply With Quote
Old 10-22-2006, 03:38 PM   #10
bunsco
Registered User
 
Join Date: Oct 2006
Posts: 7
Default

you got it to work!?

copied and pasted your ammendment and still no joy
bunsco is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Right click and middle mouse detection MichaelxxOA Projectors and CDs 11 05-23-2006 02:34 PM
Mouse Event in Classes rfan622 ActionScript 2.0 5 05-05-2005 09:29 PM
unloadMovie - Extra mouse click problem?!? drforbin ActionScript 2.0 5 05-02-2005 06:22 PM
button 'click' event not triggering the button eventHandler: using addEventListener bleepbloop Components 2 09-09-2004 09:52 PM
Click event firing just once ~annie~ Components 1 05-27-2004 04:02 AM


All times are GMT. The time now is 03:22 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.