Archive for the ‘as3’ Category

Using flashvars with swfobject 2.2 and as3

Monday, March 15th, 2010

After looking around in google almost 1 hour I did not find a simple example about using flashvars, as3 and swfobject 2.2 so I create this simple one.

Create the file index.html

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="www.argenisleon.com">

<title>Using FlashVars with SWFObject 2.2 in ActionScript3</title>
<script type="text/javascript" src="swfobject.js"></script>
</head>
<body>
    <div id="flashitem"></div>
	<script type="text/javascript">
		var flashvars = {
			name1: "hello",
			name2: "world",
			name3: "foobar"
		};
		var params = {};
		var attributes = {};
		swfobject.embedSWF("flashvars-as3.swf",  "flashitem", "300", "300", "9.0.0","expressInstall.swf", flashvars, params, attributes);
	</script>
</body>
</html>

And a flash file named flashvars-as3.fla

    var allFlashVars:Object = LoaderInfo(this.root.loaderInfo).parameters;
    output.appendText("\n" + String(allFlashVars['name1'])+ "\n");
    output.appendText("\n" + String(allFlashVars['name2'])+ "\n");
    output.appendText("\n" + String(allFlashVars['name3'])+ "\n");

of course you need swfobject.js
This example will pass the variables name1, name2 and name3 from the html file to the flash player.

Also you can download the whole files here. flashvars.zip

As3 banner rotator and xml

Tuesday, February 24th, 2009

Once again looking in google, and I just did not find any banner rotator in as3 for free. So, here is the as3 code for a banner rotator using xml.

It use QueueLoader , Hydrotween and Falcon. You can use images and swf. Furthermore, you can configure some parameters like the image o swf url and the buttons proporties like x,y and separation.

As all the source code here you can use it in comercial and non-commercial projects.

Art in the example by www.leonjuan.com

DOWNLOAD as3 banner rotator

ShortLoader. Load images or SWF’s in 1 code line

Sunday, September 28th, 2008

Sometime ago i was looking for a as3 class that let load and external asset and put a load bar while it was loading. But i did not found any utility so I write ShortLoader.

ShortLoader let you load an external asset a SWF or Image in one code line. Also you can customize easily the loading animation modifying a default library object.