Goodmorning Guys and some Girls,
For a school assignment i’ve to build a photogallery in AS 3.0. i chose for a xml releated gallery because the data would be flexibel to load. The gallery i want to make is similar the one at gamespot.com (toppest that scrolls to al the features , reviews, previews etc).
For this gallery i’ve made a thumbnail class named: Thumbnails.as the code is as follow.
my problem is that i can’t load the thumbnails on my stage. I know that i’ve to make a imageloader but how can i connect that to my thumbnails?
I would be very glad if somebody can help me out here because i’ve worked my *** of but simpley i can’t fix it.
package
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
public class Thumbnails extends Sprite
{
// basic variabels for the thumbnails
private var ThumbWidth:int = 70;
private var ThumbHeight:int = 44;
public function Thumbnails (){
//teken de thumbnails
graphics.beginFill(0xFF0000, 1);
graphics.drawRect(10, 10, ThumbWidth, ThumbHeight)
graphics.endFill();
}
}
}
in my main class called: Main.as i’ve the following.
package
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.display.Loader;
public class Main extends MovieClip
{
//dit zijn de stage variabels die te maken hebben met de breedte en hoogte van het document
private var stageBreedte:int = 570;
private var stageHoogte:int = 280;
public function Main()
{
//stage opzetten
stage.stageWidth = stageBreedte;
stage.stageHeight = stageHoogte;
graphics.beginFill(0x000000, 1);
graphics.drawRect(0, 0, stageBreedte, stageHoogte);
//xml variabels
var urlRequest:URLRequest = new URLRequest("eindopdracht.xml");
var urlLoader:URLLoader = new URLLoader();
var myXML:XML = new XML();
var xmlList:XMLList;
urlLoader.addEventListener(Event.COMPLETE,fileLoaded);
urlLoader.load(urlRequest);
//de functie fileLoaded om te kijken of de xml geladen is
function fileLoaded(event:Event):void {
myXML = XML(event.target.data);
xmlList = myXML.children();
//loop maken door de xml data
for (var i:int = 0; i < xmlList.length(); i++) {
var thumbUrl:String = xmlList.thumbnail;
var bigpicUrl:String = xmlList.bigfoto;
}
}
}
}
}