all groups > flash (macromedia) > september 2007 >
You're in the

flash (macromedia)

group:

Pop Up Question


Pop Up Question ist_04
9/4/2007 9:00:48 PM
flash (macromedia): I am confused on why script will not work in Movie Clips. I use Flash MX Pro
2004 & I am currently using the following script for the button:

on (release) {
address = "URL here";
target_winName = "";
width = 990;
height = 528;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 0;
resizable = 0;
//sends data back to the function
openWinCentre(address, target_winName, width, height, toolbar, location,
directories, status, menubar, scrollbars, resizable);
}

And in a Action Script Layer:

_root.openWinCentre = function (url, winName, w, h, toolbar, location,
directories, status, menubar, scrollbars, resizable) {
getURL ("javascript:var myWin; if(!myWin || myWin.closed){myWin =
window.open('" + url + "','" + winName + "','" + "width=" + w + ",height=" + h
+ ",toolbar=" + toolbar + ",location=" + location + ",directories=" +
directories + ",status=" + status + ",menubar=" + menubar + ",scrollbars=" +
scrollbars + ",resizable=" + resizable + ",top='+((screen.height/2)-(" + h/2 +
"))+',left='+((screen.width/2)-(" + w/2 + "))+'" +
"')}else{myWin.focus();};void(0);");
}

Works great throughout my site. The problem is when i put the same button in a
Movie Clip, the pop up no longer works. I have tried adding the AS into the
movie clip with no luck. Any suggestions, or is this just a flaw?

Thanx in advance
Re: Pop Up Question dzedward
9/4/2007 9:22:31 PM
give your MovieClip an instance name, lets say, my_mc.. place this in the
action script layer you have already.. (not on the MovieClip)

my_mc.onRelease = function() {
address = "URL here";
target_winName = "";
width = 990;
height = 528;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 0;
resizable = 0;
//sends data back to the function
openWinCentre(address, target_winName, width, height, toolbar, location,
directories, status, menubar, scrollbars, resizable);
}

Re: Pop Up Question ist_04
9/5/2007 7:23:49 PM
I should explain better. The buttons are contained in an MC, for a scrollbar.
That way i can scrolldown through several buttons, and click each one for a
different window. What code should be used for something like this?

Yhanx
Re: Pop Up Question dzedward
9/5/2007 7:35:36 PM
so is this how it is layed out:
Main Timeline:
action script layer with above code on a frame
movie clip
Movie Clip Timeline:
Re: Pop Up Question ist_04
9/5/2007 7:40:36 PM
Yup, the action script layer contains the following to make it all work:

_root.openWinCentre = function (url, winName, w, h, toolbar, location,
directories, status, menubar, scrollbars, resizable) {
getURL ("javascript:var myWin; if(!myWin || myWin.closed){myWin =
window.open('" + url + "','" + winName + "','" + "width=" + w + ",height=" + h
+ ",toolbar=" + toolbar + ",location=" + location + ",directories=" +
directories + ",status=" + status + ",menubar=" + menubar + ",scrollbars=" +
scrollbars + ",resizable=" + resizable + ",top='+((screen.height/2)-(" + h/2 +
"))+',left='+((screen.width/2)-(" + w/2 + "))+'" +
"')}else{myWin.focus();};void(0);");
}

A button on a page with the following works well:

on (release) {
address = "URL here";
target_winName = "";
width = 990;
height = 528;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 0;
resizable = 0;
//sends data back to the function
openWinCentre(address, target_winName, width, height, toolbar, location,
directories, status, menubar, scrollbars, resizable);
}

But when i put that same button(s) in the MC timeline to create the custom
scrollbar, nothing works!
Re: Pop Up Question dzedward
9/5/2007 7:56:14 PM
Re: Pop Up Question ist_04
9/5/2007 7:58:31 PM
Re: Pop Up Question dzedward
9/5/2007 8:07:32 PM
actually, you will only need it for the function.. try this... if _parent.
doesn't work replace with _root

on (release) {
address = "URL here";
target_winName = "";
width = 990;
height = 528;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 0;
resizable = 0;
//sends data back to the function
_parent.openWinCentre(address, target_winName, width, height, toolbar,
location, directories, status, menubar, scrollbars, resizable);
}


Re: Pop Up Question ist_04
9/5/2007 8:12:42 PM
Re: Pop Up Question dzedward
9/5/2007 8:15:06 PM
AddThis Social Bookmark Button