开发者

Easiest way to send text from HTML to a .swf element

开发者 https://www.devze.com 2023-04-03 20:32 出处:网络
I was trying to send 4 paragraphs to a .swf element. I have no idea how to what to do. I tried using FlashVars but I feel like i need to drop in some actionscript to be able to work with the vars

I was trying to send 4 paragraphs to a .swf element. I have no idea how to what to do. I tried using FlashVars but I feel like i need to drop in some actionscript to be able to work with the vars

conceptsNdisciplinesPar=(some text)&cultures&countriesPar=(some text) etc开发者_高级运维...

Is there an easy way to get access to this text in my .swf?


If you are successfully embedding the flash vars into your HTML embed, then yes, you can access those values from within the SWF:

for (var flashVar:String in stage.loaderInfo.parameters)
{
    trace(flashVar+":"+stage.loaderInfo.parameters[flashVar]);
}

Note, you'll need a reference to the stage for this to work. It's usually always available, but I have sometimes run into situations where my SWF needs to listen for the Event.ADDED_TO_STAGE event before using the above code.


ExternalInterface.callBack; is the best way to send data from html to .swf.

for more to know about externalInterface click here.

0

精彩评论

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