Importing external images into Flash using ActionScript 3.0

Hey Guys!
What i'm trying to do it import a few (say four) images from
an external
folder at random and display them in a row. The folder would
contain up to a
hundred pictures, sequentially named (ie. 1.jpg, 2.jpg,
3.jpg, 4.jpg,
etc...)
any suggestions on how I could do this??
thanks,
-Chris

thanks for getting me started! Is there a way to get the four
images
directly out of an external folder, though?
thanks,
-Chris
"kglad" <[email protected]> wrote in message
news:f7eop9$8um$[email protected]..
> here's code to get you started. this allows you to
select 4 of your
> images at
> random. then use the loader class and its load method to
start your loads
> and
> use its contentloaderinfo property to attach listeners
to detect if
> there's
> been a load error (so you can load another) and load
completion (so you
> can
> position your images):
>
>
>
> Array.prototype.shuffle = function() {
> var p:int;
> var t:int;
> var ivar:int
> for (ivar = this.length-1; ivar>=0; ivar--) {
> p=Math.floor((ivar+1)*Math.random())
> t = this[ivar];
> this[ivar] = this[p];
> this[p] = t;
> }
> };
> var tl:MovieClip=this;
> var swfNum:int=100;
> var num:int=0;
> var i:int;
> var swfA:Array=[];
> for (i=1; i<=swfNum; i++) {
> swfA.push(i+".jpg");
> }
>
> swfA.shuffle();
>
> // swfA[0], swfA[1], swfA[2], swfA[3] contain references
to 4 of your
> images
> randomly selected. if one of them doesn't exist
> // use the ieError event to select the next one at
random: swfA[3] etc.
>

Similar Messages

  • When importing an image into Flash, the filesize is reported incorrectly

    I saved an image from Photoshop using "Save for Web" and managed to bring the filesize down to 56.5kb. When I import this image into Flash and click on the properties, the reported "Original" filesize is 1884.6kb which is a heck of a lot more. How can I import the image and retain the filesize without having to compress the image further causing a horrible quality image?

    right click one of your bitmaps, click properties and tick "allow smoothing".  retest.

  • Importing Photoshop image into Flash without discoloration

    Hello, I just put together a banner image in photoshop that I would like to import into Flash and put a small navigation menu at the bottom but whenever I use the import to stage feature I am getting a large amount of discoloration in the image.  I've tried saving it as a .tif and .png but both came out looking poor.  Attached is an image to show what I mean.  Anyone have a suggestion on this?

    >>One more thing when you created this graphic did you make sure to use web color only, rmember the web views I think only 246 colors (somenthing like that) so anything outside of gamut will go to the next best thing.<<
    That isn't true at all. The web safe color palette had nothing to do with the limitation of the web and everything to do with the limitation of color monitors at the time it was proposed. At the time the color palette was proposed many displays could only display a maximum of 256 colors on screen simultaneously. The operating systems reserved about 20 colors each for their own use and that left 216 available color slots. Anything about that number that tried to display on screen at the same time would caouse color banding (what gifs images do to photos).
    But that was along time ago.

  • Importing multiple images into flash movie as a movie

    I have about 200 images that have been rendered for me frame
    by frame, how do I put this into flash as a movie? I don't want to
    do this manually as it would be a complete waste of my time.
    Much thanks in advance!

    you can import them as an image sequence, then create a movie
    clip out of it. File-->import-->import to stage.. Then select
    all the images, and it something should pop up asking if you are
    trying to create an image sequence, select yes.

  • Can't import an Image into flash

    When I tyr to import an Image onto Adobe Flash CS5, the image is balnk with grey outlines.
    Same thing happens when I try and copy and paste a image onto flash.

    I have created a dad on 9.0.3, and the import works. The dad in both are identical to what I can see. The 10gAS Apache logs has a preceding error message, here is the complete error messesages generated by the 10gAS Apache server when I try to import an application :
    [Mon Jun 13 08:58:13 2005] [warn] [client 172.22.101.206] [ecid: 1118671093:172.23.5.52:11116:0:1608,0] mod_plsql: DMS Logging: Unable to open/create /modplsql.lck
    [Mon Jun 13 08:58:13 2005] [error] [client 172.22.101.206] [ecid: 1118671093:172.23.5.52:11116:0:1608,0] mod_plsql: /astech/wwv_flow.accept
    HTTP-404 ORA-00904: "CONTENT": invalid identifier
    I have searched metalink for anyting on the "modplsql.lck" error and have not found anything.

  • Importing external images into shared components

    Hi,
    I need to use a UP&DOWN arrow image "GIF" files in one of my portal hierarchy component.
    I could not locate these type of up&down arrow gif files in images direcftory of shared components.
    However left and right arrows are available, but I need up&down arrows.
    How can I import a externally created "GIF" file into images folder of shared components.
    Any ideas/pointers are appreciated.
    Thanks in advance,
    Surya

    You can add the image (store it in wwdoc_document$) and then refer to it using the /docs/??.gif method. Or , add it to a folder
    and then refer to it. One piece of unsolicited advice: why don't you store it on the file system. In my experience, the image is
    retrieved a lot faster, than when in the db (and you avoid the security checks that the Portal makes)
    Hi,
    I need to use a UP&DOWN arrow image "GIF" files in one of my portal hierarchy component.
    I could not locate these type of up&down arrow gif files in images direcftory of shared components.
    However left and right arrows are available, but I need up&down arrows.
    How can I import a externally created "GIF" file into images folder of shared components.
    Any ideas/pointers are appreciated.
    Thanks in advance,
    Surya

  • Importing images into Flash

    I am importing images into Flash only to discover that the images (1280 x 720) are not centered on the stage.  Most of the time the images are off centre by a few pixel widths or in some cases by an inch or more.   I can't get them to centre unless I clear the stage and import a few times.
    Is there a way to import and have the images framed perfectly within the stage.
    I'm currently using Flash CS5.5
    Thank you.

    You can also click the two blue boxes icon under the Timeline and then drag select the whole timeline and that will let you select all your frames at once. then just position them all where you want them at the same time. I attached a screen cap of the area I'm talking about. It's right after the two white boxes.

  • Error in importing image into SAP using SE78

    Hi to all,
    I was trying to upload a '.bmp" image into SAP using SE78 but I failed.
    Se78 -> BMAP Bitmap Image -> Graphic -> Import -> Specified the complete path ->given name desc and type .
    Ended up with the following message.
    Graphic TRF_LOGO_REV could not be saved
    (2TRF_LOGO_REV)
    Pls. help as I am not sure whether I missed any step.
    Thankx in advance.

    Hi,
    Go to SE78 Transaction ie Aministration of form graphics,
           there select GRAPHICS General Graphics,under this BMAP Bitmap Images will come.
           select that,then a sub window will appear.
    There give the name of your logo and select the import button which is at the extreme left.
           Then again a sub window appears,there give the path name and name of the logo,and some description then press enter.
    Now the logo is uploaded,for preview you can select last button which is print preview.
    Now goto the form,select the window where you want to print the logo.
           Then in that window place the cursor at tag coloumn and select command line.
           Now go to INSERT and select GRAPHICS.A subwindow appers click on 'stored on Document Server',
           give the name of the logo and press enter.
           Then the image information will be displayed on the form.Save the form and activate it.
    Go to se38 transaction write the print program and execute.
    Regards,
    jaya

  • Importing Images into Flash CS4 from Photoshop 7

    Hello,
    I've created an image in flash, basically the image is a ring which has then been divided into 3 equal segments, each segment exists on its own seperate layer with and has a transparent background. I want to make ach of these segments into a button on flash, so I've imported them across and converted them into buttons, however the problem I have is that when it gets imported into flash, it creates a box around each segment which is what flash sees as the full button, this means when you roll over a blank piece of the segment flash recognises it as rolling over the button. Is this just an inherent problem from importing from photoshop into flash or am I doing something wrong?
    Thanks
    Sean

    Check the settings:
    Edit/Preferences.../PSD File importer...
    And then load the *.psd file without the background.
    And certainly there is no change in flash...

  • Unable to load external image into iOS app with AS3

    Just trying out Flash Builder for iOS app development and have run into a problem right off the bat with loading an external image into an iOS app.  The actionscript is very simple (this was basically my Hello World attempt), and I'm hoping someone here can explain where I'm going wrong.  This code works in Flash Pro, and works when launched on the desktop from Flash Builder, but doesn't work on my iOS devices.
    Here's the code:
                                  var container:MovieClip = new MovieClip();
                                  addChild(container);
                                  var imageLoader:Loader = new Loader();
           imageLoader.load(new URLRequest("http://www.google.ca/intl/en_ALL/images/logos/images_logo_lg.gif"));
                                  imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, startListener);
      function startListener (e:Event):void{
                                                 container.addChild(imageLoader);
    Any thoughts on why this won't work would be greatly appreciated!

    I had the same issue, and modified my domain policy file as specified  in http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html#_Configuring_URL_M eta-Policies but the loader is not loading the file. Any ideas on how to fix this issue?

  • Load external jpeg into flash movie

    Hi, how do i load external jpeg into flash movie?
    Can someone show me the actionscript? Thanks

    hi, i pasted the code on a mc but it didn't work.
    However, when i put in on frame action, it works.
    However, i realised the image flickered (more like refreshed)
    after afew sec...
    Is this normal? Is it the loop problem? how do i get rid of
    that?

  • InDesign CS3 Scripting XML Import Multiple Images into same Text Frame

    I am having trouble importing multiple images into the same Text Frame using XML import. I imported 5 images into the text frame. However, all 5 images are laying on top of one another. Does anyone know if there is a way to have all images laying out like how Microsoft Word handles inline images, i.e., laying out next image to the right of previsous image in the same line and if there is not enough space left in the line, then wrap to next line. Thanks in advance. I understand I could use JavaScript to do post import processing, e.g, calculate the image size and place each images accordingly. But I am trying to see whether there is a way to do this without scripts.

    You can apply an object style to all anchored images by script. A text frame containing main flow should be selected.
    var doc = app.activeDocument;
    var textFrame =  app.selection[0];
    var rectangles = textFrame.texts[0].rectangles;
    if (rectangles.length > 0) {
         for (var i=0; i < rectangles.length; i++) {
              rectangles[i].appliedObjectStyle = doc.objectStyles.item("Cover");
    However, there is a better approach:
    Step 1
    Create place holders for a single "Book" element and format it as needed -- apply an object style to the cover.
    Step 2
    Import the xml file -- the placeholders are replaced with data from the 1st xml element
    Step 3
    Drag & drop the element containing all "Books" elements into the main flow -- all elements are placed and formatted the same way as in step 1.
    Finally, add a new page, click the overset text icon and autoflow text to add pages so that to fit all the text.
    Hope this helps.
    Kasyan

  • I imported 635 images into an iPhoto album so that I can share them via a photo-stream. However, iPhoto says there are only 600. When I try to add the missing images it says they are already there. Why can i not see these images in iPhoto?

    I imported 635 images into an iPhoto album so that I can share them via a photo-stream. However, iPhoto says there are only 600. When I try to add the missing images it says they are already there. Why can i not see these images in iPhoto?

    Generally I would not use Facebook for sharing any photos, it compresses the photos substantially, and when you have shadows and dark colours you get visible "bands" where there should be subtle gradients, ie at sunsets and sunrises.
    It sounds like you are using two methods to upload to Facebook:
    1. Sharing from within Aperture, which basically syncs Facebook with your Aperture album, so any changes made at either end gets synced, hence the deletions from Albums, although the original file should still be in your library, just removed rom the album. It is like a playlist in iTunes.
    2. Exporting pics and uploading to Facebook from the browser.
    I am not sure how method 1 gets compressed, but I know that uploading hi-res jpegs to Facebook using method 2 results in poor quality images.
    I wouldn't even bother comparing option 1 or 2, and they will both be poor images once you view them on Facebook, as opposed to viewing uploaded images on proper image sharing / hosting sites.
    Your problem is not with Aperture, it is using Facebook for showing your work.
    If you export pics form Aperture at high res jpegs or TIFFs your images will be fine.
    If you insist to use Facebook as your way to share your work, then your workflow should be this:
    1. Right click images you want to share.
    2. Select Export version.
    3. Export as 100% size and ensure the export settings are set at 100% quality.
    4. Upload this pic into Facebook.
    This will get you the best image size and resolution on Facebook.
    See how you go.

  • How to import csv data into Oracle using c#

    Hello,
    How to import csv data into Oracle using c #. Where data to be imported 3GB in size and number of rows 7512263. I've managed to import csv data into Oracle, but the time it takes about 1 hour. How to speed up the time it takes to import csv data into oracle. Thank you.
    This is my code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Diagnostics;
    using System.Threading;
    using System.Text.RegularExpressions;
    using System.IO;
    using FileHelpers;
    using System.Data.OracleClient;
    namespace sqlloader
    class Program
    static void Main(string[] args)
    int jum;
    int i;
    bool isFirstLine = false;
    FileHelperEngine engine = new FileHelperEngine(typeof(XL_XDR));
    //Connect To Database
    string constr = "Data Source=(DESCRIPTION=(ADDRESS_LIST="
    + "(ADDRESS=(PROTOCOL=TCP)(HOST= pt-9a84825594af )(PORT=1521 )))"
    + "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=o11g)));"
    + "User Id=xl;Password=rahasia;";
    OracleConnection con = new OracleConnection(constr);
    con.Open();
    // To Read Use:
    XL_XDR[] res = engine.ReadFile("DataOut.csv") as XL_XDR[];
    jum = CountLinesInFile("DataOut.csv");
    FileInfo f2 = new FileInfo("DataOut.csv");
    long s2 = f2.Length;
    int jmlRecord = jum - 1;
    for (i = 0; i < jum; i++)
    ShowPercentProgress("Processing...", i, jum);
    Thread.Sleep(100);
    if (isFirstLine == false)
    isFirstLine = true;
    else
    string sql = "INSERT INTO XL_XDR (XDR_ID, XDR_TYPE, SESSION_START_TIME, SESSION_END_TIME, SESSION_LAST_UPDATE_TIME, " +
    "SESSION_FLAG, VERSION, CONNECTION_ROW_COUNT, ERROR_CODE, METHOD, HOST_LEN, HOST, URL_LEN, URL, CONNECTION_START_TIME, " +
    "CONNECTION_LAST_UPDATE_TIME, CONNECTION_FLAG, CONNECTION_ID, TOTAL_EVENT_COUNT, TUNNEL_PAIR_ID, RESPONSIVENESS_TYPE, " +
    "CLIENT_PORT, PAYLOAD_TYPE, VIRTUAL_TYPE, VID_CLIENT, VID_SERVER, CLIENT_ADDR, SERVER_ADDR, CLIENT_TUNNEL_ADDR, " +
    "SERVER_TUNNEL_ADDR, ERROR_CODE_2, IPID, C2S_PKTS, C2S_OCTETS, S2C_PKTS, S2C_OCTETS, NUM_SUCC_TRANS, CONNECT_TIME, " +
    "TOTAL_RESP, TIMEOUTS, RETRIES, RAI, TCP_SYNS, TCP_SYN_ACKS, TCP_SYN_RESETS, TCP_SYN_FINS, EVENT_TYPE, FLAGS, TIME_STAMP, " +
    "EVENT_ID, EVENT_CODE) VALUES (" +
    "'" + res.XDR_ID + "', '" + res[i].XDR_TYPE + "', '" + res[i].SESSION_START_TIME + "', '" + res[i].SESSION_END_TIME + "', " +
    "'" + res[i].SESSION_LAST_UPDATE_TIME + "', '" + res[i].SESSION_FLAG + "', '" + res[i].VERSION + "', '" + res[i].CONNECTION_ROW_COUNT + "', " +
    "'" + res[i].ERROR_CODE + "', '" + res[i].METHOD + "', '" + res[i].HOST_LEN + "', '" + res[i].HOST + "', " +
    "'" + res[i].URL_LEN + "', '" + res[i].URL + "', '" + res[i].CONNECTION_START_TIME + "', '" + res[i].CONNECTION_LAST_UPDATE_TIME + "', " +
    "'" + res[i].CONNECTION_FLAG + "', '" + res[i].CONNECTION_ID + "', '" + res[i].TOTAL_EVENT_COUNT + "', '" + res[i].TUNNEL_PAIR_ID + "', " +
    "'" + res[i].RESPONSIVENESS_TYPE + "', '" + res[i].CLIENT_PORT + "', '" + res[i].PAYLOAD_TYPE + "', '" + res[i].VIRTUAL_TYPE + "', " +
    "'" + res[i].VID_CLIENT + "', '" + res[i].VID_SERVER + "', '" + res[i].CLIENT_ADDR + "', '" + res[i].SERVER_ADDR + "', " +
    "'" + res[i].CLIENT_TUNNEL_ADDR + "', '" + res[i].SERVER_TUNNEL_ADDR + "', '" + res[i].ERROR_CODE_2 + "', '" + res[i].IPID + "', " +
    "'" + res[i].C2S_PKTS + "', '" + res[i].C2S_OCTETS + "', '" + res[i].S2C_PKTS + "', '" + res[i].S2C_OCTETS + "', " +
    "'" + res[i].NUM_SUCC_TRANS + "', '" + res[i].CONNECT_TIME + "', '" + res[i].TOTAL_RESP + "', '" + res[i].TIMEOUTS + "', " +
    "'" + res[i].RETRIES + "', '" + res[i].RAI + "', '" + res[i].TCP_SYNS + "', '" + res[i].TCP_SYN_ACKS + "', " +
    "'" + res[i].TCP_SYN_RESETS + "', '" + res[i].TCP_SYN_FINS + "', '" + res[i].EVENT_TYPE + "', '" + res[i].FLAGS + "', " +
    "'" + res[i].TIME_STAMP + "', '" + res[i].EVENT_ID + "', '" + res[i].EVENT_CODE + "')";
    OracleCommand command = new OracleCommand(sql, con);
    command.ExecuteNonQuery();
    Console.WriteLine("Successfully Inserted");
    Console.WriteLine();
    Console.WriteLine("Number of Row Data: " + jmlRecord.ToString());
    Console.WriteLine();
    Console.WriteLine("The size of {0} is {1} bytes.", f2.Name, f2.Length);
    con.Close();
    static void ShowPercentProgress(string message, int currElementIndex, int totalElementCount)
    if (currElementIndex < 0 || currElementIndex >= totalElementCount)
    throw new InvalidOperationException("currElement out of range");
    int percent = (100 * (currElementIndex + 1)) / totalElementCount;
    Console.Write("\r{0}{1}% complete", message, percent);
    if (currElementIndex == totalElementCount - 1)
    Console.WriteLine(Environment.NewLine);
    static int CountLinesInFile(string f)
    int count = 0;
    using (StreamReader r = new StreamReader(f))
    string line;
    while ((line = r.ReadLine()) != null)
    count++;
    return count;
    [DelimitedRecord(",")]
    public class XL_XDR
    public string XDR_ID;
    public string XDR_TYPE;
    public string SESSION_START_TIME;
    public string SESSION_END_TIME;
    public string SESSION_LAST_UPDATE_TIME;
    public string SESSION_FLAG;
    public string VERSION;
    public string CONNECTION_ROW_COUNT;
    public string ERROR_CODE;
    public string METHOD;
    public string HOST_LEN;
    public string HOST;
    public string URL_LEN;
    public string URL;
    public string CONNECTION_START_TIME;
    public string CONNECTION_LAST_UPDATE_TIME;
    public string CONNECTION_FLAG;
    public string CONNECTION_ID;
    public string TOTAL_EVENT_COUNT;
    public string TUNNEL_PAIR_ID;
    public string RESPONSIVENESS_TYPE;
    public string CLIENT_PORT;
    public string PAYLOAD_TYPE;
    public string VIRTUAL_TYPE;
    public string VID_CLIENT;
    public string VID_SERVER;
    public string CLIENT_ADDR;
    public string SERVER_ADDR;
    public string CLIENT_TUNNEL_ADDR;
    public string SERVER_TUNNEL_ADDR;
    public string ERROR_CODE_2;
    public string IPID;
    public string C2S_PKTS;
    public string C2S_OCTETS;
    public string S2C_PKTS;
    public string S2C_OCTETS;
    public string NUM_SUCC_TRANS;
    public string CONNECT_TIME;
    public string TOTAL_RESP;
    public string TIMEOUTS;
    public string RETRIES;
    public string RAI;
    public string TCP_SYNS;
    public string TCP_SYN_ACKS;
    public string TCP_SYN_RESETS;
    public string TCP_SYN_FINS;
    public string EVENT_TYPE;
    public string FLAGS;
    public string TIME_STAMP;
    public string EVENT_ID;
    public string EVENT_CODE;
    I hope someone can give me a solution. Thanks

    The fastest way is to use external tables or sql loader (sqlldr). (If you use external tables or sql loader, you don't use C# at all).

  • Import Illustrator file into Flash

    I'm using Flash CS4 and I want to import an *AI file that contains the shapes of Europe's countries. The thing is that each country has a filling of dots (blue or yellow) instead of a solid color. Here is a screenshot of my Illustrator screen:http://img5.imageshack.us/img5/6983/testedd.jpg
    When I import the AI into Flash all these dots become rasterized and everything looks like squashed because, I no longer have vector dots but instead bitmaps. Example of the exported SWF: http://takeab.us/SPL_embed/index_carte.html
    (try and right-click and Zoom In; you'll see how bad it looks)
    So, what's the best way in importing an AI file and keeping also the vector shapes? I've tried with a version EPS and still no hope.

    Well object expand is what I did then copy and paste, I am not certain of the reason to crop.
    this is what i got when I expanded copied and pasted. so I do not think the crop is necessary it pastes as a symbol and the symbol is clipped which I think is what you want.
    But if in this case you want the stroke as well once you select anyone of the countries they have no stroke according t the tool bar proxy and so it you give it a stroke using say a swatch and then expand copy and paste you get both the fill and the stroke if you desire the stroke as well.
    In the case of France and Paris once you paste those into Flash after you stroke and expand then you select both the city and the country and make that into a symbol so that they are one.
    And I notice from the art you sent all you have to do is select a country expand, copy, paste and then undo the expand and you are good t go do your work.

Maybe you are looking for

  • Is there a way to download PAGES 4 for MAC OS? Pages 5 is missing too many features I need!

    Is there any way to get the prior version of Pages (4x) for MAC? So many critical features are missing now I cannot use Pages any longer unless I can get the old version? Mike

  • Calling Stored Procedure in Table Object

    Dear All i can run a Stored Procedure in App Module Level. is there any way to call this procedure in object level or call it from appmodule level ? Many Thanks Edited by: Oracle ITself on Mar 22, 2010 12:08 PM

  • Custom Tag Calling

    Can someone describe the process that JSF Servers use to call a tag. I'm writing a custom tag (actually a library of them) and I need one to call another tag. in other words: instead of: <my:tag1> <my:tag2> i'm creating a class called my:tag3, that w

  • Aol Mail Not Loading Completely

    Hello I just recently noticed all my mail on my aol does not load. all my accounts load completely my .mac,gmail etc.. just the 1st 10 emails load and that's it, it doesn't give me the option to load 25 or 50 more like it did before. it was fine befo

  • Catalyst Instant Access: EtherChannel distributed via parent and client?

    Hello, can we build a EtherChannel that has some ports on the parent switch (C6807XL-) and some on the client (C6800IA-48TD)? Is that scenario supported now and if not will it be supported in the future? Thanks in advance and kind regards Matthias