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

flash actionscript

group:

Controlling Browser Elements via JavaScript or ActionScript



Controlling Browser Elements via JavaScript or ActionScript Octothorpe
11/30/2006 9:15:44 PM
flash actionscript: From within one Flash movie, I'd like to open another browser window containing
a different Flash movie. The movie opens just fine, but I'd like to deactivate
the menu bar, address bar, and toolbar.

Questions:

? Can I control/set these elements?
? Should this be done with AS? With JavaScript?
? I've heard that using JS to perform such a task is problematic in some
browsers?

Any help shedding light on these questions is greatly appreciated.

Octothorpe
Re: Controlling Browser Elements via JavaScript or ActionScript Flashpuke23423
11/30/2006 11:49:29 PM
You can control them from JS. Never use AS, it sucks and is propretary. Flash
is crrap and not a real development platform. stick to HTML,CS,JS,AJAX as much
as posssible. window.open has the params you want, and I've never heard of
them having a problem. Use JS to call it.
Re: Controlling Browser Elements via JavaScript or ActionScript Flashpuke23423
11/30/2006 11:50:05 PM
Re: Controlling Browser Elements via JavaScript or ActionScript Dave54
11/30/2006 11:55:11 PM
I'm not 100% sure, but I think this is what you need, it worked for me.
Put this in the action script:

on (press) {

getURL("javascript:openNewWindow('?????.html','thewin','height=400,width=400,to
olbar=no,scrollbars=yes')", "_blank");
}

Specify your own window size, scroll bar yes/no, etc.
Hope this helps

Re: Controlling Browser Elements via JavaScript or ActionScript Dave54
12/1/2006 12:04:28 AM
on (press) {
getURL("javascript:openNewWindow('????.html','thewin','height=400,width=400,toolbar=no,scrollbars=no')", "_blank");
}

I tried this, it doesn't work any suggestions?
Re: Controlling Browser Elements via JavaScript or ActionScript Octothorpe
12/1/2006 8:17:21 PM
Re: Controlling Browser Elements via JavaScript or ActionScript I tried
12/1/2006 8:40:58 PM
I would suggest getting yourself a javascript primer if you're going to do any
sort of web programming. I've found some free tutorials hosted by
http://www.w3schools.com/ really helps. Second, it looks like Dave's script is
using a javascript function that's he's added to the page, it's not part of the
standard javascript library. The real javascript command is
window.open(params). There are many many examples on the web of how to do this
given the right search. Just be aware that it's real easy to get confused on
the quotes and parentheses required for any getURL command that calls
javascript.
Re: Controlling Browser Elements via JavaScript or ActionScript anonymous thing
12/1/2006 8:46:09 PM
use window.open(....) not openNewWindow it doesn't exist...
I suggest you to call a Js function in your html file to open a pop-up; so
this way you can code exceptions depending on the user-agent. If you really
want your pop-up in Flash use this syntax :

getURL("javascript:window.open('yourHtmlFile.html','someIdToRefer','width=200,
height=400, location=no, menubar=no, resizable=no, scrollbars=no, status=yes,
toolbar=no, titlebar=yes')");
Re: Controlling Browser Elements via JavaScript or ActionScript Octothorpe
12/1/2006 8:48:44 PM
We've already had to make a decision that addresses my initial question, but
I'm still curious about whether or not there's a problem using JavaScript from
within Flash on certain browsers.

Is this correct? Is it inadvisable to use JavaScript from within Flash?
Re: Controlling Browser Elements via JavaScript or ActionScript I tried
12/1/2006 9:09:15 PM
At my company, we do a lot of actionscript/javascript communication. I don't
think it's inadvisable to call javascript from within flash. You need to do
whatever the situation warrants using the right technology having the
cleanest/easiest to maintain code possible. Sometimes there won't be any other
way. Yes, javascript does perform differently on different browsers, but it's
getting more standardized than it was in the past. That being said, I would
definitely suggest using the ExternalInterface library from within flash as the
best way to communicate with javascript.

Good luck
AddThis Social Bookmark Button