(also sorry about double posting)
So I’m trying to make an xml photogallery.
I made a separate AS file that I’m referencing in the time line to call up and display the xml info.
on my AS file (which I’ve saved as "GALLERYscript.as) i have:
package {
public class Test {
}
}
import flash.display.Sprite;
import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class Main extends Sprite
{
protected var _data:XML;
protected var _images:Array;
public function Main():void
{
init();
}
protected function init():void
{
var urlLoader:URLLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, dataLoaded, false, 0, true);
urlLoader.load(new URLRequest("images.xml"));
}
protected function dataLoaded(e:Event):void
{
_data = new XML(e.currentTarget.data);
_images = new Array(_data.photo.length());
build();
}
protected function build():void
{
previous_btn.addEventListener(MouseEvent.CLICK, traverseImage, false, 0, true);
next_btn.addEventListener(MouseEvent.CLICK, traverseImage, false, 0, true);
loadImage(0);
}
protected function loadImage( index:int ):void
{
if (_images[index])
{
replaceImage(_images[index]);
return;
} else
{
var loader:Loader = new Loader();
loader.load(new URLRequest(_data.photo[index].img));
_images[index] = loader;
replaceImage(loader);
}
}
protected function replaceImage( obj:DisplayObject ):void
{
while(picture_mc.numChildren) picture_mc.removeChildAt(0);
picture_mc.addChild(obj);
}
protected function traverseImage(e:MouseEvent):void
{
var index:int = _images.indexOf(container_mc.getChildAt(0));
if (e.currentTarget == previous_btn) index--;
else if (e.currentTarget == next_btn) index++;
index %= _images.length;
if (index < 0) index = _images.length - 1;
loadImage(index);
}
}
and in my timeline i have:
import GALLERYscript;
var obj:GALLERYscript;
obj = new GALLERYscript();
obj.identify();
When I export my movie though I’m getting the error:
1114: The public attribute can only be used inside a package.