Results 1 to 2 of 2

Thread: AS3 layers issue

Hybrid View

  1. #1
    Join Date
    Jan 2004

    AS3 layers issue

    Hi I am new to as3

    I have a layer question
    I know that in flash cs3 each object is given its own layer

    I declare the loader object in the function
    the addchild after load is complete for that picture
    but it seem to be only loading the one image
    that is the last image in my xml.

    I am trying to get it to load all the images on the screen at once

    I have the following code that loads an image on to the screen from an xml file.

    var loader:URLLoader = new URLLoader();
    loader.dataFormat = URLLoaderDataFormat.TEXT;
    loader.load(new URLRequest("xml/main.xml"));
    var myXML:XML;
    function loadXML(evt:Event):void
    			myXML = new XML(evt.target.data);
    			trace("Could Not Parse the XML\n");
    function init(event:MouseEvent):void
    	var n = 0;
    	var currSlide:DisplayObject;
    	var bitmap:Loader = new Loader();	
    	for(var i = 0;i<myXML.title.length();i++){
    		var stImage:String = myXML.title[i].image.toString();
    	    bitmap.load(new URLRequest(stImage));
    		bitmap.x = Math.floor(50+n);
    		bitmap.y = Math.floor(50+n);
    this is the xml.
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE data[
    <!ELEMENT title(comments, image)>
    <!ATTLIST title name CDATA #REQUIRED>
    <!ELEMENT comments (#PCDATA)>
    <!ELEMENT image (#PCDATA)>
    	<title name="Phone No1.">
    		<comments>This is phone Number 1</comments>
    	<title name="Phone No2.">
    		<comments>This is phone Number 2</comments>
    	<title name="Phone No3.">
    		<comments>This is phone Number 3</comments>
    	<title name="Phone No4.">
    		<comments>This is phone Number 4</comments>
    	<title name="Phone No5.">
    		<comments>This is phone Number 5</comments>
    	<title name="Phone No6.">
    		<comments>This is phone Number 6</comments>
    	<title name="Phone No7.">
    		<comments>This is phone Number 7</comments>

  2. #2
    Join Date
    Nov 2007
    Are you able to post your FLA and images into a zip?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles