开发者

Can I inject javascript code from the address bar into a flash video

With regular HTML it开发者_Go百科's possible to change the look of the page and make new cookies using javascript simply by typing it into the address bar and hitting Enter on keyboard.But what about flash videos.Is there a way to preform some action on the video on the page using javascript in the address bar?


Unless I have misunderstood your question, I would advise that the last thing you would want to do is allow Javascript entered into your address bar to have any control over your page content.

Doing so allows users to abuse your pages and is also a security threat.

If you can avoid passing Javascript via the address bar, it is entirely possible for Javascript to 'control' flash objects on the page. Check this out:

http://livedocs.adobe.com/flex/3/langref/flash/external/ExternalInterface.html

And also this thread too:

Controlling a Flash Player using JavaScript


You don't need that.
AS3 has the ExternalInterface class that deals with calling JavaScript functions from Flash.
You can both call JavaScript functions and get results returned by JavaScript functions directly from Flash.

All you need is read this:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html

Added after comments:
User is asking if JavaScript placed in address bar can "mess with swf" file. JavaScript can only mess with SWF execution of its AS code if it contains callbacks that get data from JavaScript which are not properly sanitized. JavaScript directly in address bar is less of a wary because using various addons, software etc (Firebug, Dragonfly) you can write as much JavaScript as you want and execute it as if it was part of that site (client side execution).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜