Getting FlashVars from class based AS3 with swfObject

Hi, I'm tryng to get a Flashvar as a string from swfObject using a document class but it is tracing a null - can anybody tell me what I'm doing wrong?

code is below

Thanks a lot, Paul
<div id="flashLoad"></div>
	<script type="text/javascript">
		// <![CDATA[
		var soFlash = new SWFObject("testClass.swf", "myDate", "184", "145", "9", "#FFFFFF");
		soFlash.addVariable("uniqueDate", "2010,4,30,00,00");
		// ]]>



package {

	import flash.display.MovieClip;

	public class testClass extends MovieClip {

		public var getDate:String;

		public function testClass() {

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Are you using SWF Object version 2?

There is a free AIR app which generates the HTML wrapper for you on the SWF Object Google Code page:

Here is a nice video which describes how to use the AIR app as well as a general introduction to using SWF Object 2:

As for your actual code, try placing the script tag inside of head instead of body and see if it makes a difference. I have attached the new code with some additional changes.

If it still doesn't work, just reply back.

Good luck with your programming,
	<script type="text/javascript">
		var flashVars = {}
		flashVars.uniqueDate = "2010,4,30,00,00";
		swfobject.embedSWF("testClass.swf", "flashLoad", "184", "145", "10.0.0", "", flashVars);
    <div id="flashLoad">
        If you are seeing this message, you don't have Flash installed.
        Too bad...

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SideasAuthor Commented:
Thanks IqAndreas   swfObject 2 looks good.

I had to cast it as a string too:

var uniqueDate: String = LoaderInfo(this.root.loaderInfo).parameters.uniqueDate;
                  dateText.text = uniqueDate;

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.