Loganathan Natarajan
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=OWYrYlg5VW9GZUI4UjV nMXFOUGsrQ T09 .. i need only "OWYrYlg5VW9GZUI4UjVnMXFOU GsrQT09" .. 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>
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
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);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you
NP. Glad to help : )
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.item
Hope this helps.
Warm Regards
Deepanjan Das