Hey, I got a huge problem. I am basing my site layout all one this one actionscript thingy…when you press a button, a window pops up. The window is from the library. It’s called “ContactWindow” and its linkage is “contact”. I have been tearing my hair out trying to figure this out, but I can’t seem to get this one!! Someone help!!
Using Flash MX
Thanks a lot!!
-Dan
When I press the button, nothing happens!! :lol:
do a test movie, hit the button, then do a “view objects” has the object appeared in that list or not?
on (release) {
MovieClip.attachMovie(contact,Contactwindow);
}
There’s the script…i just know that something is missing
this.attachMovie("contact", "t"+i, i);
Is that what you’re doing ?
pom 0]
What the heck is the “t”+i, i ? Where did that come from?
Still isn’t working!!! Someone send me your AIM sn, so we can talk it out over instant messaging…that would be nicer
I don’t have it.
“t”+1 is the name of the clip when it’s attached. Actually, that was part of this code (it goes to an empty clip) :
onClipEvent (load) {
        i = 0 ;
        function trinity () {
                i++;
                attachMovie("agent", "t"+i, i);
                var mc = this["t"+i];
                mc._x = _xmouse;
                mc._y = _ymouse;
        }
}
onClipEvent (mouseDown) {
        pressing = 1;
}
onClipEvent (mouseUp) {
        pressing = 0;
}
onClipEvent (enterFrame) {
        if (pressing) {
                trinity();
        }
}
pom 0]
Ahhhhh!!! Too confusing!! I am not the greatest at actionscripting, so i don’t understand…
system
May 21, 2002, 9:29pm
10
Are you sure you want to attach movie ?
If so, you need a button with the code :
on (press) {
i++;
_root.attachMovie("contact", "t"+i, i);
var mc = _root["t"+i];
mc._x = Math.round(Math.random()*500);
mc._y = Math.round(Math.random()*400);
}
Still not good ?
pom 0]
system
May 21, 2002, 10:10pm
11
as long as you’ve got the linkage set, it should work fine dan. The code problem that I see is this.
on (release) {
MovieClip.attachMovie(contact,Contactwindow);
}
in this example, what is “MovieClip”? It should be an instance name of a movie clip that you’re attaching this too, or it should be “_root”
like this
on (release) {
_root.attachMovie(“contact”,“newName”,aDepthNumberHere);
}
where “contact” is the name of the movie in the linkage dialogue box, and “newName” is the instance name of the attached movie.
system
May 21, 2002, 11:48pm
12
Thanks you guys!!! I don’t know what I would do without you! I still gotta test it out though…Thanks a bunch!
-Dan
system
May 22, 2002, 9:30am
13
Pom, thanks for that code!! But I only want one to pop up, because if I push it again, another window pops up!! I don’t want that to happen, do I just have to remove the ++ in the “i++” ?
system
May 22, 2002, 12:24pm
14
on (press) {
_root.attachMovie(“contact”, “t1”, 1);
var mc = _root.t1;
mc._x = Math.round(Math.random()*500);
mc._y = Math.round(Math.random()*400);
}
system
May 23, 2002, 4:09am
15
Well… this one will actually keep doing the effect every time you press the button, but you probebly wont notice that a new movie clip is being attached at the same level, with the same content, and deleting the previous mc at that level.
system
May 24, 2002, 5:26am
16
The only trouble Upu is that the movie is placed randomly in that code, so you’ll notice the attachment. Dan, You can use the usual trick :
on (press) {
if (clicked) {
clicked = !clicked ;
_root.attachMovie("contact", "t1", 1);
var mc = _root.t1;
mc._x = Math.round(Math.random()*500);
mc._y = Math.round(Math.random()*400);
}
}
pom 0]
system
May 24, 2002, 5:51am
17
I dont’ see why it needs to be random in there at all. You can just set the x and y to whatver you like. Or even keep track of an array of locations so that the windows always popped up in a particular place, but not necessarly the same place.
ultimately all you need is
on (press) {
_root.attachMovie(“contact”, “t1”, 1);
}
system
May 25, 2002, 1:01pm
18
Yeah yeah yeah, but as there was random in your code, I just thought I’d say… Anyway.
pom 0]
system
May 30, 2002, 4:00am
19
sorry… I downplayed your discovery of my error. My ego was showing again.