dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Image Arrangement from an Array

  1. #1
    Senior Member
    Join Date
    Jul 2000
    Posts
    131

    Image Arrangement from an Array

    I have a library of filmmaking tutorials that I am trying to make a website for. I would like to have something like http://www.gotoandlearn.com but all in flash.

    Here is my solution, but it is fraught with issues.

    1) Created a movieclip with several dynamic textfields (title, description and length. This movieclip also has an image movieclip holder in it.
    2) Created the database for the content.
    3) Created the php script for AMFPHP that gets the data
    4) Write the code that brings the data into Flash.

    Now Here is where I'm stumbling cause I'm not usually a code monkey.. more of a designer.

    Here is the line of code that gets all the images.
    Code:
    var thumbURLReq:URLRequest = new URLRequest("thumbs/" + this.ResTutorials[i][3]);
    However, they are all coming in right on top of one another. How can I get them into 2 columns and down the page like http://www.gotoandlearn.com?

    Even more so, how can I get these linked movieclip holders that have all the text fields in them to populate with all the data I've plugged in.

    I know it probably doesn't help to include my code, but I'm going to do it anyway just in case someone sees this who can help.

    Code:
    //----------------------------------------------------
    // This next portion of code connects to the database 
    //----------------------------------------------------
    
    var columns:Number = 2;
    var padding:Number = 5;
    var left:Number = 15;
    
    //Store the image width and height (40x40)
    var imageWidth:Number = 125;
    var imageHeight:Number = 90;
    
    //Creates the holder with text and photos
    var tutHolder:holder = new holder();
    		tutHolder.x = 50;
    		tutHolder.y = 50;
    		addChild(tutHolder);
    
    var gw:NetConnection = new NetConnection();
    gw.connect("http://localhost:8888/amfphp/gateway.php");
    
    
    
    var res:Responder = new Responder(onResult, onFault);
    this.ResTutorials = new Array;
    
    
    function onResult(responds:Object):void{
    	this.ResTutorials = responds.serverInfo.initialData;
    	for(var i:uint=0; i<this.ResTutorials.length; i++)
    	var thumbURLReq:URLRequest = new URLRequest("thumbs/" + this.ResTutorials[i][3]);
    	var thumbLdr:Loader = new Loader();
    	thumbLdr.load(thumbURLReq);
    	
    	// Create MovieClip holder for each thumb
    	var thumb_mc = new MovieClip();
    	thumb_mc.addChild(thumbLdr);
    	addChild(thumb_mc);
    	thumb_mc.buttonMode = true;	
    
    }
    
    
    function onFault(responds:Object):void{
    	trace('fail');
    }
    
    
    
    gw.call("ISMFilmsLite.getTutorials", res);

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    You need to have add an eventlistener to trace when the images are loaded.

    thumbLdr.contentLoaderInfo.addEventListener(Event. COMPLETE, completeHandler);
    function completeHandler(event:Event):void
    {
    //arrange the x and y values of your content here
    }
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    131
    Hey, thanks for the reply. I got the eventlistener in there now... but the real problem still persists, how do I get it to do 2 columns? I guess what I'm trying to say is that the arranging of images is what is really confusing to me.

Tags for this Thread

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