I m loading images from a folder through xml in flash CS3 using AS 3.0, and than i want that whenever i click on any image the corresponding large size image will be shown in a movie clip also placed on stage…
The problem is that the images are positioned i want 3 images per row under the tabs menu also i made a class in which the properties are set like name and images but when i call them in base class it gives errors.
1120: Access of undefined property Name.
1120: Access of undefined property image.
1119: Access of possibly undefined property Name through a reference with static type Products.
1119: Access of possibly undefined property image through a reference with static type Products.
The base class is here:
package
{
import flash.display.*;
import flash.events.*;
import flash.xml.*;
import flash.net.*;
import area;
import Products;
public class BaseClass extends MovieClip
{
var showArea:area;
var tab1Show_mc:tab1;
var tab2Show_mc:tab2;
var tab3Show_mc:tab3;
var Bar:bar;
var mc:Products;
var xml:XML;
//var xmlList:XMLList;
var req:URLRequest;
var xloader:URLLoader;
var Imageload:Loader;
var imgContainer:MovieClip = new MovieClip();
public function BaseClass():void
{
req = new URLRequest("test.xml");
xloader= new URLLoader(req);
xloader.addEventListener(Event.COMPLETE, loadimage);
//Imageload.addEventListener(MouseEvent.ROLL_OVER, plusAlpha);
//Imageload.addEventListener(MouseEvent.ROLL_OUT, minusAlpha);
tab1Show_mc = new tab1();
tab1Show_mc.x = 630;
tab1Show_mc.y = 150;
addChild(tab1Show_mc);
tab1Show_mc.buttonMode = true;
tab2Show_mc = new tab2();
tab2Show_mc.x = 733;
tab2Show_mc.y = 150;
addChild(tab2Show_mc);
tab2Show_mc.buttonMode = true;
tab3Show_mc = new tab3();
tab3Show_mc.x = 836;
tab3Show_mc.y = 150;
addChild(tab3Show_mc);
tab3Show_mc.buttonMode = true;
Bar = new bar();
Bar.x = 782;
Bar.y = 197;
addChild(Bar);
showArea = new area();
showArea.width = 450;
showArea.height = 450;
showArea.x = 300;
showArea.y = 375;
addChild(showArea);
tab1Show_mc.addEventListener(MouseEvent.CLICK, loadMCpro);
tab2Show_mc.addEventListener(MouseEvent.CLICK, loadMCstick);
}
function loadimage(e:Event):void
{
xml = new XML(e.target.data);
//xmlList = new XMLList(xml.children());
var _Initialx:Number = 280;
var _Initialy:Number = 250;
var k:int = 0;
for (var i:int = 0; i<xml.images.length(); i++)
{
Imageload = new Loader();
for (var j:int = 1; j < 3; j++)
{
if(k<xml.images.length())
{
Imageload.load(new URLRequest (xml.images[k]));
Imageload.x = _Initialx + 100;
Imageload.y = _Initialy;
mc = new Products(Name, image);
mc.addChild(Imageload);
imgContainer.addChild(mc);
mc.Name = "product " + i;
mc.image = "X " + xml.images[k];
imgContainer.alpha = .5;
imgContainer.buttonMode = true;
_Initialx = Imageload.x;
}
k=k+1;
}
_Initialy = Imageload.y + 100;
}
this.addChild(imgContainer);
}
/*function plusAlpha(event:MouseEvent):void
{
Imageload.alpha = 1;
}
function minusAlpha(event:MouseEvent):void
{
Imageload.alpha = .5;
}*/
function loadMCstick(event:MouseEvent):void
{
imgContainer.visible = false;
}
function loadMCpro(event:MouseEvent):void
{
imgContainer.visible = true;
}
}
}
and the products class is here:
package
{
import flash.display.*;
public class Products extends MovieClip
{
public var N:String;
public var I:String;
public function Products(N,I):void
{
var Name:String = N;
var image:String = I;
}
}
}
plz help me it’s my project i tried very much but fail to resolve…