Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








[CS3] PLEASE Help With Importing PNGs


First of all, thanks in advance for any help.

I recently finished working through Lynda.com's Flash CS3 Essential Training course. I learned there that PNGs could be imported, and if there's just a white background, other backgrounds could be seen, through anti-aliasing. That worked fine for the example they gave me. I imported their supplied PNG and changed the background color, and it worked fine.

I am now working on a project where I have drawn a image of a beach, and want to put my family on it. I took a picture of all of us, and then went into Paint. I erased all surrounding areas, so that there was just my family and a white background. I saved that file as a PNG. I then went into Flash, and imported that video onto the stage. However, it showed the white background around my family, and did not do correct anti-aliasing (is that the right term? I;m pretty sure it is). Does anybody know how to fix this issue? Please respond quickly, as I am eager to finish this project!




FlashKit > Flash Help > Flash Newbies
Posted on: 03-27-2008, 05:17 PM


View Complete Forum Thread with Replies

Sponsored Links:

Importing .pngs
Hey Ppl

-Interesting problem Im going through.

Ive made some 24bit png's in PS. They import gorgeously into flash. They animate well in the movie I create. However, when I test the movie or when I export it the png gets a strange distortion like its being resized by a pixel in one direction or another.

Ive checked:
-the size of the original, the size of the graphic, the size of the movie and the size of the movie on the stage.
-I removed all elements except for the png in question(it does this to them all)
- the properties of the original graphic and changed the compression to png lossless.
- turned off the jpg compression

...and still it looks great until I test the movie- Im completely stumped now- Any ideas?

cheers,
Adam

View Replies !    View Related
Importing .pngs
Hey Ppl

-Interesting problem Im going through.

Ive made some 24bit png's in PS. They import gorgeously into flash. They animate well in the movie I create. However, when I test the movie or when I export it the png gets a strange distortion like its being resized by a pixel in one direction or another.

Ive checked:
-the size of the original, the size of the graphic, the size of the movie and the size of the movie on the stage.
-I removed all elements except for the png in question(it does this to them all)
- the properties of the original graphic and changed the compression to png lossless.
- turned off the jpg compression

...and still it looks great until I test the movie- Im completely stumped now- Any ideas?

cheers,
Adam

View Replies !    View Related
Importing Pngs, No Options...
In Flash 5, when you imported a PNG image, you were given the prompt to choose whether or not to flatten the image or import with editable objects (the latter is what I want to do).

In MX, when I import a PNG, I don't get the prompt. Is there a way I can either turn this feature on or locate this dialog box to initiate on my own?

Any help much appreciated, because I think, by default, that PNG's are flattened. Again, I don't want to do this, I want to have editable objects.

Thanks in advance for any help or advice!

View Replies !    View Related
Problem With Importing PNGs From PS 5.0
Hey all. I'm having a problem with a Flash movie I'm working on... I'm trying to import a transparent PNG image so I can create an out-of-focus effect in the movie. Unfortunately, I only have Adobe Photoshop 5.0, which does not come with ImageReady like Photoshop 5.5 and later versions have. So I can't use the "Save for Web" feature, which allows you to set the PNG-24 settings, transparency settings, and so on.

What I have done is set up an Alpha channel in the document for the transparency, and then save it as a normal PNG file. When I import that PNG file into Flash, the transparency works fine but the actual image is much darker than it should be. Does anyone know what this means, and how I can get around this problem?

Thanks in advance
-RobsH66

View Replies !    View Related
Importing Transparent PNGs...
Hi there..

I've designed a png logo with transparency, but for some reason, I'm unable of importing it to the project... Flash MX 2004 doesn't give any warning, but it simply doesn't display it neither on the stage nor in the Library...

Any idea???


Thanks

View Replies !    View Related
Importing PSD Or PNGS? (Transparent)
Since Flash CS3 imports PSDs, should I continue importing PNGS and JPEGS?
I am importing Transparent PSDs and find the published file swf size is a little smatter than when I import transparent PNGs.
What is the rule of thumb with Flash CS3 and importing?

Thanks for your help.

View Replies !    View Related
Dynamically Importing Gif's Or Pngs
Would anyone know if it would be possible to import gifs dynamically into flash at runtime? http://www.kirupa.com/developer/mx20...otogallery.htm
I used this tutorial to make a photo gallery with an external xml file. I know IE doesnt like png's but flash wont even import gifs only jpgs. This sux for me as i need a transparent background.... someone helpppppppppppppppppppppppp

View Replies !    View Related
Dynamically Importing Gif's Or Pngs
Would anyone know if it would be possible to import gifs dynamically into flash at runtime? http://www.kirupa.com/developer/mx20...otogallery.htm
I used this tutorial to make a photo gallery with an external xml file. I know IE doesnt like png's but flash wont even import gifs only jpgs. This sux for me as i need a transparent background.... someone helpppppppppppppppppppppppp

View Replies !    View Related
Importing PNGs Distorts Color (Mac Issue?)
I can't seem to figure this out. Perhaps somebody can test this on their Mac.

Here's my setup:
Mac G5
Photoshop CS
Flash MX 2004

Create a new file in PS and fill area with the following hex color: 1f2325. Save as PNG and import into Flash. Take a screenshot of the color and open it in PS. The value of the color should still be 1f2325. Unfortunately that is not the case for me. If I create the PNG on a PC, and import it into Flash on a Mac, there is no color shift. I've tried various color profiles for PS including turning it off. Still same problem. Opening the saved PNG in PS still shows the original color (1f2325), but once its in Flash, it shifts. Any ideas?

View Replies !    View Related
Difficulty Importing PNGs Into Flash MX 2004
I tried to import a 640x480 PNG file into Flash MX 2004 but after I click open, nothing happens. Where has my picture gone to?

View Replies !    View Related
Jagged Pngs...anyone?
i have a few pngs in an mc. they look great in the staging environment, but the second i publish the movie and have a mask move over top...the pngs become all jagged and crappy lookin. does anyone have a fix for this? thanks a ton in advance.
charles

View Replies !    View Related
Imported PNGs
hello all--
i imported some png's (text) into flash, and they (forgive me, i can't think of a better term) are really unclear around the edges. i wanted to turn off the anti-alias on the text, and i couldn't find a way to do that in flash. so i just imported from fireworks. any fixes on this?
josh

View Replies !    View Related
Can't Import PNGs
Since loading Swift3D into my system I can no longer import transparent PNGs in FlashMX. FlashMX will still allow me to import all other image formats. It appears that the Swift3D software reconfigured something in my system to cause this to occur. I believe FlashMX now interprets the PNGs for fireworks but I can't say for sure. I removed Swift3D from my system and reinstalled FlashMX several times but to no avail. How can I get FlashMX to import transperant PNGs again without having to resort to reformatting my hard drive?
My email is: BOBWestPalmBeach@aol.com

View Replies !    View Related
Pngs Resizing In Swf
i'm having a problem where certain pngs are "squished" in the swf. its like pixels are overlapping. it appears fine in the fla file. is this a bug?

help? asap. thanks!

View Replies !    View Related
[F8] Loader With Pngs
hi. firstly, i wasn't sure if i should post this in this section or in another one, but i'll post it here because it's my first post.

anyway, i've been using flash for a little while, and i'm pretty certain i can build a regular flash loader/preloader using the in-built flash components (rectangles etc.). but what i cannot figure out how to do is to build one using two images instead. it's a bit confusing, so i prepared a few images to help explain it a bit better:

here is the outline of the loader:

and here is the finished loader:

what i want to achieve with this is to get from the first image/frame to the last image/frame as the page loads (using actionscript code). i am aiming for something like this:

as you can see, the shape is being filled in constantly as the page loads. of course, i would have it a lot smoother, but i just made a quick animated gif to explain how i wanted it to look.

i tried doing this myself, using a mask and a few other things, but i couldnt figure out how to make it display properly -- ie. how i explained it above. hopefully someone can help me out!

thanks in advance.

View Replies !    View Related
Feathered PNGs
Is it not possible to feather and soften the edges of an image on a transparent background in PS3, and then import it to Flash as it looks? I have done this with PNG24 and Flash still kills the edge to where it is hardened with no feather. Please advise.
Thanks

View Replies !    View Related
Empty MCs And PNGs
I promised I searched before asking this question.

I'm putting together the ol' XML Slideshow but I want to use pngs instead of jpgs. My understanding was that Flash 8 allowed this. When I try and run it with pngs it outputs "undefined". When I change the xml to load a jpg it works. I'm loading the images into empty movie clips if that helps.

Here is a snippet of actionscript:


Quote:




bigshirt_mc.loadMovie(bigshirt[p], 1);




And the corresponding XML:


Code:
<bigshirt>landscape/assets/shirt1.png</bigshirt>
Like I said, when I change the xml to shirt1.jpg it works. Any suggestions?

Thanks!

View Replies !    View Related
PNGs Vs JPEGs
Hi there,

You may have some expertise that could help me... I am building a flash movie and would like to know the difference between PNGs and JPEGs.

I have saved all my files as a JPEGs, should I resave them as PNGs?

I also have some questions posted in another topic that have gone unanswered in the title "Flash Movie Questions". Would you consider these questions if you have time.

Thank you for your help!
Billy

View Replies !    View Related
JPS/PNGs Turn To Greyscale?
OK, maybe this is a "feature" of the Trial version of Swish Lite, but I've added the same file (made in PSP) both as a jpg and as a png and when I preview in a browser (or add the code manually), it turns into a greyscale object. The animated text, etc is fine. BTW, I DO know that the trial version scrambles the text when you export, so maybe this is just the Trial version?

Anyone know?

It previews just fine in Swish Lite (full color), but NOT in the browser.

I can't believe the product doesn't produce color backgrounds using jpg/pngs...maybe I missed something stupid?

View Replies !    View Related
External Gifs And Pngs
I had an action script that would load in a jpg at run time. Can Flash load external Gifs or PNGs? If not, is there a work around?

Thanks.

View Replies !    View Related
Dynamic PNGs In MX04?
Does anyone know if you can only load swfs and jpgs still, or can pngs be used dynamically in Flash MX 2004?

View Replies !    View Related
PNGs Go Weird When In Symbol?
Hi - im using some transparent PNG files that look file when I import them into flash 6- but as soon as I make them into s a symbol (and after i compile) they start cutting up slightly as if theyve been rotated or something?!

does anybody why this could be?!

many thanks

View Replies !    View Related
Loading Pngs Dynamically?
Hi,

Can you load pngs into a flash movie in the same way you can jpgs?

Right now I'm using:

mc.loadMovie("test.jpg");

.. to load jpgs into my movie. Doesn't seem to work on pngs tho.

View Replies !    View Related
Is It Possible For A .swf To Load .PNGs Externally?
Like, the .PNGs are on my site (as is the .swf) and it will load them into the .swf when they click a button or something so I can create somewhat of a picture gallery without the .swf being very very large.

View Replies !    View Related
Mouseover To Toggle Between Pngs?
hell-o! need help.
i got a scrollable area that displays pictures...
this contains a layer where i put all the pictures and a second layer which acts as the mask.
i would like to change each individual picture into another on mouseover, or on mouseclick and vice versa.
how can i do that?
i tried converting each picture (png) into symbols then i got stuck...
help!
thanks!

View Replies !    View Related
Control Alpha Of PNGs
How do I control the alpha of a PNG graphic in flash?
Please help.

View Replies !    View Related
ImgLoader Gifs Pngs
imgLoader.loadClip("splash/"+currentImg+".jpg", random1_mc);

this code only seems to work with jpgs, how do i laod gifs and pngs?

View Replies !    View Related
Trouble With Transparent PNGs
Im having a real hard time with transparent Png-24s.

I'll make a image in photoshop or illustartor and save it for web as a png-24 , then I will import it into flash and when I put it on the stage it still has a visible background. The best way to describe it is, if my stage in flash is dark blue then the area that surrounds my png will be a couple shades lighter than dark blue.

What am I doing wrong? Is there some sort of setting that I am overlooking? I've tried and tried to figure this out, but to no avail. Any help is very very appreciated.

View Replies !    View Related
Trouble With Transparent PNGs
Im having a real hard time with transparent Png-24s.

I'll make a image in photoshop or illustartor and save it for web as a png-24 , then I will import it into flash and when I put it on the stage it still has a visible background. The best way to describe it is, if my stage in flash is dark blue then the area that surrounds my png will be a couple shades lighter than dark blue.

What am I doing wrong? Is there some sort of setting that I am overlooking? I've tried and tried to figure this out, but to no avail. Any help is very very appreciated.

View Replies !    View Related
Pngs Look Crappy In My Flash, Why?
whats up with this? why do my pngs come up messed up like this when i publish my flash movie.

View Replies !    View Related
[F8] Quick Question About Pngs
hi guys,
what is the preferred graphic format? are pngs better than jpgs or much of a muchness?
cheers,
fabs

View Replies !    View Related
Loading PNGs As Well As JPGs
I am loading in some JPGs in the HTML variables like this:

so.addParam("FlashVars", "image1=xyz.png&image2=abc.jpg&Totalimages=2). ..

the JPGs are loading but the PNGs are not - is there a way to do this? i'd like to utilize the transparancy of the PNGs (i tried GIFs too and they wouldnt work either)

thanks in advance for your help!

View Replies !    View Related
[CS3] Shape Tweening PNGs
Is it possible to shape tween 1 png image into a different Png image... If so, how is it done?

(I've tried applying a breakapart to each image, but that did a wacky few replications of the first image and only flashed the second image)

(then I tried the "trace bitmap" feature to both images, but it seems to take a lot of time to convert the pngs to traced bitmaps)

Am I missing something? Or is this totally not possilbe? I replicating this by hand isn't really an option as I am not an artist.

Thanks in advance for all input.

View Replies !    View Related
PNGs Vs BMPs Question
howdy

I have a simple 18-frame clip that has one png in each of them (converted to symbols).. @ 20fps .. and when it runs compiled it takes FOREVER .. SIX seconds to run the sequence.. BUT!

I downloaded someone's flash sample of a rotating IPod (25 .bmp images, NOT converted to symbols, just straightup .bmps in each keyframe) and it runs beautifully, no sluggishness or anything.. Why would this be??

thanks
lobs

View Replies !    View Related
I Can't Click Through Transparent Pngs...
In AS2, you could layer transparent pngs, and movieclips with them, over your buttons and retain their functionality even though they were underneath a bitmap: a sort of window pane effect... Can't seem to do that in AS3, it recognizes the transparent png as fully opaque for mouse events. Is there a way to override the 'visibility' of the transparent png to mouse events?

Thx

View Replies !    View Related
PNGs Not Rendering As Transparent
Has anyone ever encountered this weird, unique error I am getting

When I export my program to a SWF all the imported PNGs with alpha transparency (ie; soft edges) render totally wrong - no transparency, very blocky and pixelated. See the attached image for an example;

http://skitch.com/madmac66/w6cx/bitmap-properties



Any ideas, this is out of the blue. Has exported fine recently.

cheers
mm66

View Replies !    View Related
I'd Prefer Not To Have Jagged PNGs
When I import transparent PNGs into flash, and (necessarily) scale them down, the edges are a bit too jagged for my liking.

See: http://helloatto.com/lionsfeather/

Is there anything I can do to fix this?
Cheers.

View Replies !    View Related
PNGs Are Jagged In Flash MX
Hello, I am creating a layout for a website using Flash MX (I know, I need to upgrade). I basically wanted to use a loader to load external SWF to make the pages transition smoothly. I have created a hollow frame and I am using buttons for navigation which are PNGs.

I am having 2 issues:

1 - The PNG buttons (on my second page, not doing this on the home page) are showing up jagged. They are images with text created in PS. I have read some fixes but none seem to work. I need the images to be transparent so I can't use a jpg.

2 - When I try to load a swf (attaching AS to the button) it works however it always shows over all my other layers. I have of course sent this layer to the back but I am still having this issue.

Any help would be great.

Thanks.

View Replies !    View Related
Dynamically Loading PNGs
This code dynamically loads .jpg but it does not seem to work for .png. What am I doing wrong?

Thanks in advance.







Attach Code

//load dynamic images
animation.onEnterFrame = function(){
if(animation._currentframe == 2){
imageNumber = (random(3))+1;
animation.imageCaller.loadMovie("http://WEBADDRESS"+imageNumber+".png");
}
}

View Replies !    View Related
How To Load Multiple PNGs In AS3
I'm at a bit of a loss as to how I can load multiple external PNG files. It seems that the classes used to display content are instantiated with the new Constructor();

So how do I give them names like, sprite1, sprite2, etc.

For example the below code. I would like to end up with something like clip1, clip2, etc. so that I can drag them around or such.

Also, I know that I can just add a Loader instance to the DisplayObjects with addChild(myLoader) but is that how I should do it? Or should these be converted to some other class? Sprite? MovieClip?







Attach Code

stop();
var images:Array=new Array("face0.png","face2.png");
var count:Number=0;
var myLoader:Loader=new Loader();
myLoader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
function initHandler(event:Event):void {
if (count<images.length) {
myLoader.load(new URLRequest(images[count++]));
}
}
myLoader.load(new URLRequest(images[count++]));

View Replies !    View Related
Printing PNGs With Transparencies
Hello,

I am having a few problems using flash.printing.PrintJobOptions and flash.printing.PrintJob.

I am successfully printing jpgs, transparent and non-transparent gifs, and non-transparent pngs, however I have having trouble printing transparent pngs. The area of the png which is transparent is becoming a solid colour when printed which is not what I would like.

Does anyone know how I could fix this? I have set PrintJobOptions to print as a Bitmap as choosing the bitmap option maintains transparencies, whereas the print as vector option does not maintain transparencies (according to the Actionscript 3.0 Bible by Wiley).

Could someone please help...

Many thanks in advance

Lee

View Replies !    View Related
Pixellated Pngs In Flash
i've got an image that i've added to flash after saving from photoshop as a png-24 file. once in flash, the image gets pixellated a little, especially when i preview it (then view the swf afterwards).

any idea on how i can keep the image from pixellating? the more i'm thinking about it, i DID resize the png image(s) in flash to get them to be the right size. would that have anything to do with it?

thanks.

View Replies !    View Related
JPGs & PNGs Always 1 Pixel Off
Okay, I have been using Flash for a LONG time now, and I seem to have the exact same problem popping up again.

When I import and place an image (not dynamically) that is, let's say 100x50px with a 1px border arround it and then publish the Flash movie, that image comes up as doubling up the border on two side (top and top left) and erasing it from the other sides (right and lower right).

The JPGs are saved at 100%, the JPGs are alwats set to cordinates 0,0 in Flash. I have turned off "smoothing" and turned off "compress movie." The same problem still occurs. Does ANYONE have ANY idea how to resolve this. All of my designs rely on specific pixels, and I just can't continue with this madness.

I you help me, I will be a ver happy man. Cheers.

-i

View Replies !    View Related
Loader Componant - PNGs
I need to important transparent pngs into my SWF, and have them clickable as buttons. Right now, I'm using JPGs with the loader component, but I'm aware this method does not work with PNGs.

Any ideas?

View Replies !    View Related
Import Sequence Of PNGs
A quote from the Help files: "Any sequence of images (for example, a PICT and BMP sequence) that you import directly into a Flash document is imported as successive keyframes of the current layer."

However, when I select a bunch of sequentially numbered PNGs to import, that doesn't happen. I've tried importing to Stage, to Library, to Stage with a layer selected, to an empty movie clip on the stage, everything I can think of. If I import to stage, Flash just slaps them all on top of each other on the same layer....

What am I doing wrong?

View Replies !    View Related
Flash And MIME And Dynamic PNGs
Ok i am strill relatively new to flash programming, what i am wanting to do is get an image from a socket and display it to screen, the socket work is not a problem, i can do that, but what i am not sure is how to display it to screen within my flash ap.

I will receive a PNG file from down the socket as MIME encoded data, all i need to do is draw it to screen in a set place. So i will have a variable holding my PNG file, how do i get this to screen ?

Is there any way i can do this, i do not want to use a webserver or involve PHP.

Thanks in advance,

View Replies !    View Related
Flash And PNGs With Alpha Transparency
Hi everybody!
I'm currently working on a Flash game (my first game, wheee!) and I'm trying to blow up a spaceship. What I'm doing is, I have an explosion that consists of a sequence of translucent PNGs and a Shockwave that's essentially another translucent (alpha transparency) PNG which I then scale up.
Both the explosion and the shockwave work nicely including the alpha transparency. There's one thing however, that really confuses me. When I look at the explosion/shockwave inside the Flash editor, it all looks great and when the shockwave PNG is scaled up, it gets smoothed so you don't see any pixelation. As soon as I click on "Test Movie" however, the shockwave is no longer smoothed and it looks really terrible (huge pixels). Check out the attached file.

Now I tried everything... the quality is set to "High", "Allow Smoothing" is enabled for all the images, etc.

Does anybody have an idea what I might be doing wrong? Or is it simply that Flash doesn't smooth alpha-transparent PNGs?

Thanks in advance!

View Replies !    View Related
Weird Problem - Jaggy PNGs - Please Help
Hello wonderful people !

First of all, just want to thank you for all your unselfish help you are providing to us... just wonderful ! A way to go !

I have a weird problem here. I know many will think just of one thing when they see the name of this thread, but believe me this is something completely different... We all know about those PNG issues in Flash, but most of them, if not all, are fixable. That's not a problem here. I'll try to explain what happens and when.

I have one animation with few PNG files in it, and all of them are parts of the buttons. I use PNGs to tween them so I can get nice animation for button states... nothing to fancy, just normal resize from small to bigger and backward... that's not the problem at all, because when I save SWF file everything is wonderful... as long as I don't add another SCENE to the movie. I just have no clue why is this happening...

If I add new scene, let's say I want to make preloader for my main movie, while I'm still in Flash, PNGs while morphed from small size to bigger (in those button animations) becomes very jaggy. They look exactly as when ALLOW SMOOTHING option is unchecked in BITMAP properties. And believe me, it's checked. Remember, I haven't changed anything except just added new scene to the movie. This problems makes me pull my hair out... I'm trying to figure it out for last 5 days at no avail... unbelievable...

Also, COMPRESSION is set to LOSSLESS (PNG/GIF)... same thing happens if I change it to JPG regardless of what quality level I chose.

Here is a screenshoot how everything looks:



In case anyone is interested, you can see what I'm talking about in here:

First one is the one without problems and with only one scene in the movie:

:: THE GOOD ONE :: (EDIT: SWF File removed by me because of the lack of web space)

Second one is the problem one, with 2 scenes in the movie:

:: THE BAD ONE :: (EDIT: SWF File removed by me because of the lack of web space)

In case someone is interested to solve this one, I have those FLA files here... no strange ActionScript inside, nothing, just plain animation and that weird problem.

I have noticed however that jaggy edges are not because PNG becomes messed up somehow, but because it looks like, as soon as I add another scene to my movie, ALLOW SMOOTHING feature deactivates itself somehow. I noticed that when I totally enlarged movie on the screen. It looked perfectly clear, but without anti-aliasing (smoothing). Anyone has any idea what could be causing this ?

Also, same thing happens if I don't add another scene to the movie, but if I try to make preloader on the same timeline in same scene. As soon as I add it, problems appears.

Any input would be gratly appreciated and I would be thankful for life !

Thanks in advance !

View Replies !    View Related
Animating And Resizing Imported PNGs
I'm having a problem with animating imported PNG files, especially resizing them. In the .swf file, the edges get pretty screwed up and the image becomes distorted a bit, almost as if it isn't anti-aliasing itself or something. I attached an .fla file (in MX format) with a very rough example of what I'm doing. It looks fine in the .fla, but when you export it to .swf you'll see what I mean about the resizing problem. Is there any way to fix this, OTHER than using the "trace bitmap" function? The images I'm using are pretty detailed, and tracing the bitmap and converting it into a vector while keeping the detail slows the movie down way too much.

In case you're wondering, the main reason I'm doing this is for the dock at www.yanathin.com. Right now I traced teh bitmap for every dock image, giving it the "smooth" resizing animation. However, it really, really slows down when it animates on slower computers. But, when I don't convert the PNGs to highly detailed vectors, the magnifying animation gets very rough. It IS much faster though. If anybody knows how to fix this problem, PLEASE let me know! Thank you!

View Replies !    View Related
Allow Smoothing - With Externally Loaded PNGs
A bit tricky this one - as Im a designer doing some research for a coder I work with (hes up against it so hasnt got time to ask around)

Basically I want us to be able to apply the 'allow smoothing' effect that you can apply to PNGs in a library - but using code to externally loaded PNGs.

So far hes been unable to find a way to do this (without losing the alphas on the PNGs)

ANY help that you could give to try and solve this would be much appreciated

thanks a lot!
Nick

View Replies !    View Related
Using A For Loop To Load .pngs Into Clips
i'm trying to use a for loop to load images (from an array) into clips (and then use the clips as papervision movie materials).

I've only had success getting the final image in the array to actually load. My experience with AS2 leads me to believe that I have overwritten something in the for loop.

basically i need to do soemthing like this within my for loop:


Code:
for (var i:unit = 0; i < myArray; i++)
{
var nl:Loader =new Loader(); // can i re-use the same loader or do i need to create one for each image i'm trying to load?
var "nl"+i:Loader = new Loader(); can you do something like this?
nl.load(new URLRequest(myArray[i]));
movieClipInstance.addChild(nl)

here's my actual code:

Code:
for (var i:uint = 0; i<finArray.length; i++)
{
var cubeFront:frontClip = new frontClip();
var cubeBack:backClip = new backClip();

var cF:MovieMaterial = new MovieMaterial(cubeFront, true, true, false);
cF.interactive=true;

var cB:MovieMaterial = new MovieMaterial(cubeBack, true, true, false);
cB.interactive=true;

//load image into clip
var imageLoader = new Loader();

var theURL:String = finArray[i];
var imageRequest = new URLRequest(theURL);

imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);

imageLoader.load(imageRequest);

function onComplete(evt:Event) {
trace("image"+ i +" loaded!");
cubeBack.holder.addChild(imageLoader.content);
imageLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE);
}



var mList:MaterialsList = new MaterialsList({front:cF, back:cB, left:clearSide, right:clearSide,
top:clearSide, bottom: clearSide});
var cube:Cube = new Cube(mList, 120, 1, 120, 1, 1, 1);
scene.addChild(cube);
//start cube in center
cube.x=0;
cube.y=0;
cube.z=0;
cube.alpha = 0;
var cPosX:Number = XposArray[i];
var cPosY:Number = YposArray[i];
trace("cPosX: "+cPosX);
trace("cPosY: "+cPosY);

Tweener.addTween(cube,{x: cPosX, y: cPosY, alpha: 1.0, transition:"easeInOutQuad",time:1.5});

cube.alpha = 1.0;
}

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved