Groups | Blog | Home
all groups > flash actionscript > march 2004 >

flash actionscript : Contolling a button instance


J-DAX
3/4/2004 8:34:01 PM
I thought that one of the new things in scripting w MX was the ability to talk
to button instances just as you do to Movie clip ones. For some reason I am
having a hard time getting this to work.

I am trying to move the play head in a button instance to oh lets say the 6th
frame
(obviously my button has 2 more frames with graphics in them that are after
the 4 standard frames).
Normally if it was a Movie Clip I would use dot syntax to say something like:
_root.MovieClipInstanceName.gotoAndStop (6);

Can I do the same w/ a button instance?
like this:
_root.ButtonInstanceName.gotoAndStop (6);

So in an example I would have 2 buttons on the stage
the 1st button would make the 2nd buttons play head to go the 6th frame in
that button.

HELP?


Jack.
3/4/2004 8:44:30 PM
buttons do not have timelines,
the first 3 frames simply act as placeholders
for button content ( graphics,text,mc's)
the hit frame holds the hotspot area and is never seen,


J-DAX
3/4/2004 9:09:02 PM
Jack,
Thank you for that very descriptive narative on buttons.

However, since you can mannualy switch the property of a button instance to a
'graphic' and then tell it what frame to send the playhead to in that buttons
timeline (for lack of a better word), I am looking for an action scripting
solution to provide me w the same result on a different buttons on release
comand.

I know its possible to 'talk' to these button instances telling it to do other
things.


Neo75
3/4/2004 9:13:15 PM
If you want to use that you should use a movie clip instead of a button. The
only difference is that you MUST have a stop() action and write the code for
the events.
Ex: on(RollOver){} , on(RollOut), on(Press) etc etc
If you do this then you can send the play head to whatever place you want
within the movie clip button
J-DAX
3/4/2004 9:22:59 PM
Neo,

I am familliar w/ that concept and have used many times in the past.
What I am trying to do here is use one of the NEW features that scripting in
MX has regarding button instances and being able to controll them.

Still looking........
Jack.
3/4/2004 9:25:33 PM
for the functionality you seek, buttons are useless. use movieclips.

there is a way to make a clip act as if it were a button,
Frame#1 // frame label _up and stop();
Frame#2 // frame label _over
Frame#3 // frame label _down
use these labels or it will fail

give the clip an instance name, and activate from main timeline,
clip1.onRollOver=function(){ clip2.gotoAndStop("_down"); };


Jack.
3/4/2004 9:30:24 PM
for a full description of the methods available to the button object,
check the Reference under -
J-DAX
3/4/2004 9:40:21 PM
Jack,
Perhaps you didn't read my reply to Neo. (I know about using MCs instead)

Without explaining my entire project scope, I am trying to find out if any of
the
new features avaialble in MX scripting that allow you to controll a button
instance are possible in the simple example I set forth in the bottom of my 1st
posting.

I am familiar w/ the workarounds that have been suggested.

Do you know about this feature I am speaking about?

J-DAX
3/4/2004 9:43:32 PM
Jack,
OK ill take a look at the Reference.........
To see if its the same info I read in the regualr help file.
AddThis Social Bookmark Button