We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How can I parse flashvars from EMBED tag string?

Medium Priority
796 Views
Last Modified: 2012-05-11
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

Comment
Watch Question

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
Loganathan NatarajanLAMP Developer
CERTIFIED EXPERT

Author

Commented:
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
Mohamed AbowardaSenior Software Engineer
CERTIFIED EXPERT

Commented:
Find string position of the first equal char "=" and then sub string the value to get the value after the first equal "=".
Mohamed AbowardaSenior Software Engineer
CERTIFIED EXPERT

Commented:
Use something familiar to the following:
var i = myString.indexOf("=");
myString = myString.substr(i, myString.length);

Open in new window

CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2015
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Loganathan NatarajanLAMP Developer
CERTIFIED EXPERT

Author

Commented:
thank you
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2015

Commented:
NP. Glad to help  : )
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.