Link to home
Start Free TrialLog in
Avatar of Loganathan Natarajan
Loganathan NatarajanFlag for India

asked on

How can I parse flashvars from EMBED tag string?

I have the EMBED string like this and want to get only the flashvars variable as itemId=OWYrYlg5VW9GZUI4UjVnMXFOUGsrQT09 .. i need only "OWYrYlg5VW9GZUI4UjVnMXFOUGsrQT09" .. how can i read this from the below attached string?
<embed src='http://www.test.com//test_1.swf' quality="high" FlashVars="itemId=OWYrYlg5VW9GZUI4UjVnMXFOUGsrQT09&autoplay=0&duration=02:45&url=http://test.com" bgcolor="#ffffff" wmode="opaque" width="320" height="65" name="player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>

Open in new window

Avatar of deepanjandas
deepanjandas
Flag of India image

First, I feel you have posted in the wrong zone, so kindly update the zones to Adobe Flash/ActionScript.
Now, if you are using AS2, then do this to get the itemId:

var itemId:String= _root.itemId;

For AS3:
var itemId:String = loaderInfo.parameters.itemId;


Hope this helps.

Warm Regards
Deepanjan Das
Avatar of Loganathan Natarajan

ASKER

No, I am looking some preg_match way to parse or split the above EMBED tag.
Opps I am sorry :)

Not sure about the php method much but with javascript try this logic:
Split by "itemId=" and then again split the second element by "&" to get the itemId value.

Warm Regards
Deepanjan Das
Find string position of the first equal char "=" and then sub string the value to get the value after the first equal "=".
Use something familiar to the following:
var i = myString.indexOf("=");
myString = myString.substr(i, myString.length);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank you
NP. Glad to help  : )