Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Flashvars Undefined

Guest
Jul 13, 2010 Jul 13, 2010

I'm totally stumped with this flashvars problem. I've tried about a million different things and I still can't get anything to read into my SWF. Here's my embed code. It was created using SWFObject the same way CS5 outputs all HTML files:

<embed height="575" width="900" flashvars="reactionDelay=1000&link_TOS=PLEASEWORK!" allowscriptaccess="sameDomain" quality="high" bgcolor="#FFFFFF" name="waffle" id="waffle" style="" src="waffleTopper.swf" type="application/x-shockwave-flash">

Here's a different version of the embed that's on the dev site I'm trying to put my SWF on:

<object height="573" width="898" type="application/x-shockwave-flash" data="waffleTopper.swf" id="waffleTopper">

<param name="wmode" value="opaque">

<param name="flashvars" value="link_TOS=PLEASEWORK!">

<param name="allowscriptaccess" value="always">

</object>

As you can see, both of these are passing in flashvars different ways. Neither of them are working. This is the code I have on my base class. It's populating a text field with what should be in the flash var "link_TOS"

builder.builder.log.text = "link_TOS = " + LoaderInfo(this.root.loaderInfo).parameters.link_TOS;

The text bar is displaying "link_TOS = undefined". I even put this code inside a function called initIntro that gets called like so:

if (stage) initIntro();

else {

addEventListener(Event.ADDED_TO_STAGE, initIntro);

}

So this makes no sense to me. HOWEVER, when I add the flashvar to the SWF url like so:

<embed height="575" width="900" flashvars="reactionDelay=1000&link_TOS=PLEASEWORK!" allowscriptaccess="sameDomain" quality="high" bgcolor="#FFFFFF" name="waffle" id="waffle" style="" src="waffleTopper.swf?link_TOS=asdf" type="application/x-shockwave-flash">

it shows up "link_TOS=asdf" in the text box!!!!!!!

WHAT GIVES?! Can anyone help me?!

And in advance, I cannot link you to the site, it's on my local host and you'd have to VPN in to see the dev environment. Hopefully these code samples should be sufficient.

Message was edited by: BeniRose - took out work sensitive URLs

TOPICS
ActionScript
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 13, 2010 Jul 13, 2010

I'm not sure what you're doing wrong but none of the code you showed is how SWFObject does it. You might try using SWFObject though - I've never had a problem passing in FlashVars using it. With SWFObject the code would look more like so:

<script type="text/javascript">

var flashvars = {
  fname
: "Pete",
  lname
: "Smith"
};

swfobject
.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0", "", flashvars);

</script>

And then the vars should be available with:

var firstName:String = loaderInfo.parameters.fname;

var lastName:String = loaderInfo.parameters.lname;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 13, 2010 Jul 13, 2010
LATEST

The code I posted was created by SWFObject. The SWFObject code is from the old version I think, the one with so.addVariable(). It's what CS5 generates automatically when you compile a SWF and HTML, I just added the .addVariable to it. Thanks for looking though. I think the problem has something to do with where in the code I'm trying to access my flashvars. For some reason I don't think they've loaded yet or something.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines