Hi Everybody…
I’m relatively new to this and having a difficult time. I have built a image gallery with xml in ActionScript 3.0 that has 2 columns of thumbnails to pick from. Is there any way i can convert my .fla file to an .As file so the class file can be used to birth objects on the main timeline ?
My Xml code is
<? xml version="1.0" encoding="utf-8"?>
<images>
<image source="images/Image1.jpg" thumb="thumbnails/Image1.jpg">All Smiles.</image>
<image source="images/Image2.jpg" thumb="thumbnails/Image2.jpg">Enoying the live show.</image>
<image source="images/Image3.jpg" thumb="thumbnails/Image3.jpg">Dinner Outside.</image>
<image source="images/Image4.jpg" thumb="thumbnails/Image4.jpg">A couple at the Speech.</image>
<image source="images/Image5.jpg" thumb="thumbnails/Image5.jpg">Having A Dance.</image>
<image source="images/Image6.jpg" thumb="thumbnails/Image6.jpg">Having A Dance.</image>
<image source="images/Image7.jpg" thumb="thumbnails/Image7.jpg">Street Performer.</image>
<image source="images/Image8.jpg" thumb="thumbnails/Image8.jpg">High Brow.</image>
</images>
My Flash file Code is
var imageLoader:Loader;
var xml:XML;
var xmlList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
var numClips:int=6;
var columns:int=2;
xmlLoader.load(new URLRequest("data/images.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(event:Event):void
{
xml = XML(event.target.data);
xmlList = xml.children();
for(var i:int = 0; i < xmlList.length(); i++)
{
imageLoader = new Loader();
imageLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
imageLoader.x = 6 +( i % columns )*600;
imageLoader.y = 6 +(Math.floor(i/columns)*106);
imageLoader.name = xmlList[i].attribute("source");
addChild(imageLoader);
imageLoader.addEventListener(MouseEvent.CLICK, showPicture);
}
}
function showPicture(event:MouseEvent):void
{
imageLoader = new Loader();
imageLoader.load(new URLRequest(event.target.name));
imageLoader.x = 158;
imageLoader.y = 6;
addChild(imageLoader);
}
the code that i am trying to use on my new .fla file so that an .As class file can be used to birth objects on the main timeline is
import classes.interactive.gallery.ImageGallery;
var gallery:ImageGallery = new ImageGallery("data/images.xml","thumb","full");
addChild(gallery);
The code in my .As file is just a regular template where i dont know where to begin…
package
{
import flash.display.*;
import flash.events.*;
import fl.transitions.*;
import fl.transitions.easing.*;
public class ImageGallery extends MovieClip
{
public function ImageGallery()
{
}
}
}
Please help .Any feedback would be a great help