dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Loading remote images dynamically

  1. #1
    Junior Member
    Join Date
    Nov 2005
    Posts
    8

    Loading remote images dynamically

    Hi everyone

    This is a bit of a complex question to me, but it's coming from an absolute beginner and it might be considered a stupid one, that's why I posted here...

    I've kind of been dropped in the deep end with this task and I can't get it right... I have a company's organisational chart in flash where it loads in each person's name dynamically for their department and when you click on it it brings up their CV information such as name, qualifications etc. This is loaded into a dynamic text box. I can test it locally with an xml file and then switch back to the online version.

    The local version I check by switching to "strXMLpath = "organisation.xml";
    " where things are laid out as follows:

    Code:
    <organisation>
    	<bod>
    		<director>
    			<name>Alwyn Maasdorp</name>
    			<qualification>B.Com (Hons), B.Compt (Hons), Dipl in Financial Markets & Instruments, EDP Stellenbosch 
    
    Business School, passed finalist of the Chartered Institute of Management Accountants (UK), CA (SA).</qualification>
    			<description>Alwyn's career started at Standard Bank in 1991 before joining Deloitte & Touche in 1995 and 
    
    servicing clients in the retail, manufacturing and financial services sectors. In 1997 he was seconded to the San Francisco 
    
    office for 6 months. From 1998 he was a manager in the financial services audit team where he specialised in banking, insurance 
    
    and asset management.&lt;br&gt;&lt;br&gt;He joined BoE Bank in 1999, becoming General Manager: Finance in 2000. In 2002, the 
    
    position of General Manager: Operations was included in his portfolio. Following the merger with Nedbank, Alwyn was appointed as 
    
    Executive Assistant to the Group CEO of Old Mutual plc and relocated to London for 2 years.&lt;br&gt;&lt;br&gt;During this 
    
    period, he was involved with projects such as the implementation of group standards and values, the BOE/Nedbank merger, the 
    
    Nedbank restructure, the development, refinement and implementation of group strategy, the Old Mutual Group BEE transaction, 
    
    alignment of group leadership and profile building amongst international investors across the globe.&lt;br&gt;&lt;br&gt;Following 
    
    the completion of the secondment, Alwyn returned to South Africa as a founding shareholder and CEO of Pointbreak 
    
    Entrepreneurs.</description>
    		</director></organisation>
    The online version is brought in by using:

    Code:
    strXMLpath = "../Page/GetFlashData.php?FlashDataType=3&link_id="+varLink_id;
    I now have to bring in an image for each person on this chart and have been told it should be sourcing them in the same way the image gallery on the site sources images. It loads them into a movie clip.

    The local xml file for the image gallery is set up in this way:

    Code:
    <slideshow>
    	<slide label="Geocaching Photo 1" data="geocache01.jpg" caption="I have the GPS; you follow me. I have the GPS; you follow me." />
    	<slide label="Geocaching Photo 2" data="geocache02.jpg" caption="This says three paces ahead." /></slideshow>
    And it gets its online info with:

    Code:
    xmlLoader.load(new URLRequest("../Page/GetFlashData.php?FlashDataType=1&link_id="+varLink_id));
    Being a beginner, everytime I change the code I break everything and I really have a tight deadline on this so it's getting discouraging... I've thought of perhaps greating a movie clip with all the code to load in the images and then loading that into the dynamic text box with something to the effect of:

    Code:
    myTextBox.htmlText = "This is a swf: <img src='movieclip_linkage_ID'>";
    Please help...

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    If you want to load an image into Flash from an URL, and if you're using Actionscript 2, you should use loadMovie:

    loadMovie("http://www.example.org/images/image2.jpg", _root.my_image_mc);

    This will load image2.jpg, into the movieclip named my_image_mc. However, the Top-Left corner of the Image, will be positioned on the Registration Point of the movieclip (The cross in the middle of the movieclip, once you enter inside it)!

    So, an example. Open a new Flash Actionscript 2 Document, make a rectangle, select it, hit F8 and convert it to Movieclip. Click on the movieclip, open up Properties Panel (CTRL+F3), give its Instance Name, a name of my_image. Double-click the Movieclip to enter inside it, select the rectangle inside it, and remove it, so that we have a blank movieclip. Now, double-click anywhere to get out of Movieclip, and paste this code on your Frame:

    loadMovie("http://www.videogamesblogger.com/wp-content/uploads/2010/05/super-mario-galaxy-2-walkthrough-artwork.jpg", _root.my_image);

    It may take a few seconds before the image appears, but that's just because it's loading. Place that blank movieclip, near your Top-Left corner - 'cause you'll see what I mean if you place it in center

    Btw, I made this Application if you're interested in moving loaded images, or even masking them: http://pridspeed.com/Crop%20Image%20v5.swf

    Hope this helps you
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

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