Home | Web Design | App / Game development | Flash | Flash Games | Graphic Illustration | Technical Illustration | Contact | Site Map    Twitter
 
  Galaxy Graphics Limited

Technical InformationActionscript Knowledgebase: How to pick up Flashvars in AS3?

Actionscript below to pick up Flashvars passed to the SWF, and set a default if they're not found.

In the examples below, the SWF would be embedded with filename.swf?p1=hello so the internal variable Xp1 would be set to "hello" if found or "default_value" if not.

function getFlashVars():Object {
return Object( LoaderInfo( this.loaderInfo ).parameters );
}

var Xp1:String = getFlashVars().p1 || "default_value"

As it was in AS2

var Xp1 :String = _root.p1 || "default_value";

 
Site content Copyright © 2001-2014 Galaxy Graphics Limited. | Privacy Policy | Terms of use