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
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); }
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
so is this how it is layed out: Main Timeline: action script layer with above code on a frame movie clip Movie Clip Timeline:
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!
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); }
Don't see what you're looking for? Try a search.
|