dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [as3.0] thumbnails from xml

Hybrid View

  1. #1
    Junior Member
    Join Date
    Apr 2008
    Posts
    17

    [as3.0] thumbnails from xml

    hi everybody...

    I want to read thumnails from xml into clip miniatury_mc... and move them with easing up and down... after prsssing
    up arrow or down arrow... everything looks nice but I don't know how to loop clip miniatury_mc... the reference clip to mine is on site http://www.plejada.pl/

    http://rapidshare.com/files/24694974...trone.zip.html
    I'm attaching my fla file my xml file and some sample pictures maybe someone can help me

  2. #2
    rabid_Delineator AttackRabbit's Avatar
    Join Date
    Dec 2003
    Location
    Orlando, Florida
    Posts
    481
    404 error on your rapid share destination. check your upload.

  3. #3
    Junior Member
    Join Date
    Apr 2008
    Posts
    17

    http://rapidshare.com/files/246998973/stuff.zip.html

    thank You for this information... now evething should be ok http://rapidshare.com/files/246998973/stuff.zip.html now

  4. #4
    Junior Member
    Join Date
    Apr 2008
    Posts
    17
    this is my listing maybe this will help
    Code:
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    
    
    var xmlURL:URLRequest;
    var xmlLoader:URLLoader;
    
    var moveTimer:Timer = new Timer(3000);
    moveTimer.addEventListener(TimerEvent.TIMER, ruszajListe);
    
    var picReq:URLRequest;
    var picLoader:Loader;
    var tempClip:DisplayObject;
    
    xmlURL = new URLRequest("playList.xml");
    xmlLoader = new URLLoader(xmlURL);
    xmlLoader.addEventListener(Event.COMPLETE, playlistLoaded);
    
    
    function playlistLoaded(e:Event):void
    {
    	var dataXML:XML = new XML(e.target.data);
    	var liczbaMiniatur:int = dataXML.material.obrazekMaly.length();
    
    	for (var i:int=0; i<liczbaMiniatur; i++)
    	{
    		picReq = new URLRequest(dataXML.material.obrazekMaly[i]);
    		picLoader = new Loader();
    		picLoader.load(picReq);
    		miniatury_mc.addChild(picLoader);
    		picLoader.y = i * 70;
    		picLoader.name = "picture"+i;
    		
    		var tempKlip:DisplayObject = DisplayObject(miniatury_mc.getChildByName("picture"+i));
    		tempKlip.addEventListener(MouseEvent.CLICK, podajNazwe);
    		
    	}
    	
    	picLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, picLoaded);
    	function picLoaded(e:Event):void
    	{
    		for(var j:uint=1; j<=liczbaMiniatur; j++)
    		{
    			miniatury_mc.getChildAt(j).width = 80;
    			miniatury_mc.getChildAt(j).height = 60;
    		}
    		moveTimer.start();
    	}
    }
    
    function podajNazwe(e:Event):void
    {
    	trace(e.target.name);
    }
    
    function ruszajListe(e:TimerEvent):void
    {
    	downButton(null);
    }
    
    
    up_btn.addEventListener(MouseEvent.CLICK, upButton);
    down_btn.addEventListener(MouseEvent.CLICK, downButton);
    
    function upButton(e:Event):void
    {
    	var upTween:Tween = new Tween(miniatury_mc, "y", Regular.easeOut, miniatury_mc.y, miniatury_mc.y - 70, 0.3, true);
    }
    function downButton(e:Event):void
    {
    	var downTween:Tween = new Tween(miniatury_mc, "y", Regular.easeOut, miniatury_mc.y, miniatury_mc.y + 70, 0.3, true);
    }

  5. #5
    rabid_Delineator AttackRabbit's Avatar
    Join Date
    Dec 2003
    Location
    Orlando, Florida
    Posts
    481
    so you want to do something on press ? if so.. you can do this

    Code:
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    
    private var newTimer1 : Timer;
    private var newTimer2 : Timer;
    
    
    up_btn.addEventListener( MouseEvent.MOUSE_DOWN , startUpScroll , false , 0 , true );
    up_btn.addEventListener( MouseEvent.MOUSE_UP , stopUpScroll , false , 0 , true );
    down_btn.addEventListener( MouseEvent.MOUSE_DOWN , startDownScroll , false , 0 , true );
    down_btn.addEventListener( MouseEvent.MOUSE_UP , stopDownScroll , false , 0 , true );
    
    private function startUpScroll ( evt : MouseEvent ) : void {
    			newTimer1 : Timer = new Timer( 100 , 0 );
    			newTimer1.addEventListener( TimerEvent.TIMER , doUpScroll ); 
    			newTimer1.start();
    		};
    
    private function doUpScroll( evt : TimerEvent ) : void {
    //do your scroll here on your thumbnail clip
    };
    
    
    private function stopUpScroll ( evt : MouseEvent ) : void {
    newTimer1.stop();			
    newTimer1.removeEventListener( TimerEvent.TIMER , doUpScroll ); 
    neTimer1 = null;
    			
    		};
    just make the same methods for timer2 and your down button.

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