all groups > flash actionscript > april 2006 >
You're in the

flash actionscript

group:

Instance names and pop-ups


Instance names and pop-ups jkwilkerson
4/12/2006 8:58:19 PM
flash actionscript:
Greetings Fellow Flashers,

Here's my situation, I have created a movie clip that acts as a button. That
"button" is placed on the stage several time, each with a unique instance name
(butt1, butt2, etc). Is it possible to script a solution to create a pop-up box
that will display the instance name when the button is rolled over?

Much thanks in advance.
Re: Instance names and pop-ups babo_ya
4/12/2006 9:33:25 PM
Yes it is possible.
How? I don't know I need more information.
If you just need a alert dialog that shows instance's name then, it's simple.
create a movieclip looks like a dialog and name it like... alert_mc and in
alert_mc, create a text field (dynamically) using createTextField and assign
..text property to this.name. For example
this.createTextField("mytxt", 0, 0, 0, 0,0);
this.mytxt.text = this.name;


And in the main timeline...
var obj = new Object();
obj.name = "instance name";
_root.attachMovie("alert_mc", "MyAlert", obj);

hope this helps..
Re: Instance names and pop-ups jkwilkerson
4/13/2006 1:08:33 PM
did not quite work. it may be easier for me to send you the fla. would that be
ok? I have a stripped down version with comments to show what I am attempting
to accomplish? I am using to this point but it may be easier to view the entire
flaThanks

stop();

/* On the main stage there are several instances of the movie clip "Button
Master".
Each mc is given a unique instance name, (intro_btn, p2p_btn, relations_btn,
etc).
What I would like to accomplish is have the instance name appear in an "alert
box"
when the user rolls over the movie clip. So when someone hovers over the
"intro_btn" an alert box/movie clip will appear, displaying "intro_btn".
*/
intro_btn.onRelease = function () {
gotoAndPlay("intro", 1);
}

//Button to open the Person to Person area
p2p_btn.onRelease = function () {
gotoAndPlay("p2p", 1);
}
//Button to open the Relations area
relations.onRelease = function () {
gotoAndPlay("relations", 1);
}
//Button to open the Organization to Organization area
o2o_btn.onRelease = function () {
gotoAndPlay("o2o", 1);
}
//Button to open the Person to Organization area
p2o_btn.onRelease = function () {
gotoAndPlay("p2o", 1);
}
Re: Instance names and pop-ups babo_ya
4/13/2006 2:43:01 PM
intro_btn.onRollOver = function () {
mx.controls.Alert.show("intro_btn");
}
//Make sure you have 'Alert' Component in your library (Window > Component and
drag the Alert to your library.

I couldn't reply to your private message. it says the user doesn't want to
receive private message.



Re: Instance names and pop-ups jkwilkerson
4/13/2006 3:26:24 PM
Thanks for the heads up. I turned on the PM feature. As for the script, it
worked (never thought about using components), only issue is that it
essentially cancels the ability to use the button as a button. Once I scroll
over it, the alert pops up, I click cancel to get out of the alert button and
when I go to click the button, I get the roll over again as soon as I get over
the button. This may not be doable. May need to investigate plan B. lol
AddThis Social Bookmark Button