A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS3 + XML Scrolling Gallery Problem

  1. #1
    Member
    Join Date
    Sep 2010
    Posts
    61

    AS3 + XML Scrolling Gallery Problem

    I am trying to create what is essentially a gallery with XML. I have a working, sliding scrollbar with all the images I need in it. When and image is clicked, I want the 'profile' of the image to show up next to the list, filling most of the screen.

    Right now I'm just trying to get an image to show up next to the scrolling list (which already works) and am having trouble. Despite what I think is correct code, I see no image.

    Here is a chunk of relevant AS3 code:

    Actionscript Code:
    //LOAD XML
                function LoadXML(e:Event):void
                {  
                    xmlData = new XML(e.target.data);  
                      buildScroller(xmlData.image);
                 }
               
                //BUILD SCROLLER FROM XML  
                 function buildScroller(imageList:XMLList):void
                {  
                       var scroller:MovieClip = new MovieClip();  
                    this.addChild(scroller);  
                    scroller.y = 85;
                    scroller.x = 15;
                    //scroller.mask = scrollerMask;
                                   
                     for (var item:uint = 0; item < imageList.length(); item++ )  
                        {  
                        var gameThumb:MovieClip = new MovieClip();
                        var gameTitle:TextField = new TextField();
                        var gameFormat:TextFormat = new TextFormat();
                        var propertyPic:MovieClip = new MovieClip();
                       
                        propertyPic.itemNum = item;
                        propertyPic.y = 130;
                        propertyPic.x = 400;
                        propertyPic.src = imageList[item].attribute.("propertyPic");
                       
                        gameFormat.align = "left";
                        gameFormat.size = 12;
                        gameFormat.font = "Verdana";
                        gameFormat.color = "0xFFFFFF";
                        gameFormat.bold = true;
                   
                        gameTitle.defaultTextFormat = gameFormat;
                       
                        gameThumb.y = (130 + padding) * item;  
                        gameThumb.itemNum = item;
                         gameThumb.src = imageList[item].attribute("src");
                       
                        gameTitle.y = 10;
                        gameTitle.x = 100;
                        gameTitle.width = 150;
                        gameTitle.wordWrap = true;
                        gameTitle.text = imageList[item].attribute("title");
                       
                        //CREATE IMAGE CONTAINER  
                        var thisThumb:Sprite = new Sprite();
                                           
                        //PARSE IMAGES  
                        var ldr:Loader = new Loader();  
                        var urlReq:URLRequest = new URLRequest(gameThumb.src);
                        var urlReqT:URLRequest = new URLRequest(gameTitle.text);
                        var urlReqP:URLRequest = new URLRequest(propertyPic.propertyPic);
                        ldr.load(urlReq);  
                        thisThumb.addChild(ldr);  
                        gameThumb.addChild(thisThumb);
                        gameThumb.addChild(gameTitle);
                        gameThumb.addChild(propertyPic);

    And an example of the XML:

    Actionscript Code:
    <?xml version="1.0" encoding="utf-8"?>
     <images>  
        <image src="images/properties/published/300_March_to_Glory_thumbnail.jpg" title ="300 March to Glory" propertyPic="images/properties/published/300_March_to_Glory_thumbnail.jpg" />

    I hope I posted enough information for you, I can post more if needed.

    Thank you kindly,

    Ogaac

  2. #2
    Member
    Join Date
    Sep 2010
    Posts
    61
    I still haven't solved this issue, if anyone could help I'd greatly appreciate it.

    Here's a link to a zip file of the project, if you think it would help.

    Thank you kindly,

    Ogaac

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center