all groups > flash (macromedia) > august 2005 >
You're in the

flash (macromedia)

group:

Loading images into Flash via ActionScript


Loading images into Flash via ActionScript AquaBoogie
8/9/2005 10:48:38 PM
flash (macromedia):
Does anyone know if there is a way to load transparent png's or gif's via XML?

I have done it with non-progresive jpeg's, however when using transparent
images it does not work.

I understand that the Flash Player 8 is supposed to support transparency,
which I have tested on the beta version successfully.

Any assistance is greatly appreciated.


Thanks,

AB

P.S. Here is the AS I'm using:



stop ();
function loadXML (loaded)
{
if (loaded)
{
xmlNode = this.firstChild;
image = [];
description = [];
description2 = [];
total = xmlNode.childNodes.length;
for (i = 0; i < total; i++)
{
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
description2[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
firstImage ();
}
else
{
content = "file not loaded!";
}
}
xmlData = new XML ();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load ("images.xml");
//////////////This code controls the button and key stoke
controls///////////////////////
listen = new Object ();
listen.onKeyDown = function ()
{
if (Key.getCode () == Key.LEFT)
{
prevImage ();
}
else if (Key.getCode () == Key.RIGHT)
{
nextImage ();
}
};
Key.addListener (listen);
previous_btn.onRelease = function ()
{
prevImage ();
};
next_btn.onRelease = function ()
{
nextImage ();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function ()
{
filesize = picture.getBytesTotal ();
loaded = picture.getBytesLoaded ();
preloader._visible = true;
if (loaded != filesize)
{
preloader.preload_bar._xscale = 100 * loaded / filesize;
}
else
{
preloader._visible = false;
if (picture._alpha < 100)
{
picture._alpha += 10;
}
}
};
function nextImage ()
{
if (p < (total - 1))
{
p++;
if (loaded == filesize)
{
picture._alpha = 0;
picture.loadMovie (image[p], 1);
desc_txt.text = description[p];
desc2_txt.text = description[p];
picture_num ();
slideshow();
}
}
}
function prevImage ()
{
if (p > 0)
{
p--;
picture._alpha = 0;
picture.loadMovie (image[p], 1);
desc_txt.text = description[p];
desc2_txt.text = description[p];
picture_num ();
}
}
function firstImage ()
{
if (loaded == filesize)
{
picture._alpha = 0;
picture.loadMovie (image[0], 1);
desc_txt.text = description[0];
desc2_txt.text = description[0];
picture_num ();
slideshow();
}
}
function picture_num ()
{
current_pos = p + 1;
pos_txt.text = current_pos + " / " + total;
}
var delay = 10000;
function slideshow() {
myInterval = setInterval (pause_slideshow, delay);
function pause_slideshow ()
{
clearInterval (myInterval);
if (p == (total - 1))
{
p = 0;
firstImage ();
}
else
{
nextImage ();
}
}
}
Re: Loading images into Flash via ActionScript Rothrock
8/9/2005 11:08:49 PM
Doesn't matter what code you are using. Can't be done. Just jpegs and swfs. I
believe there are some third party tools out there that convert other formats
into swfs as the server sends them along. But I know nothing else about that.
Re: Loading images into Flash via ActionScript AquaBoogie
8/10/2005 12:00:00 AM
Actually it can be done.

Check out this link: http://play.ground.gr/?p=70

This is being done via the Flash Player 8 beta, which is now supposed to
support transparency.

I guess I'll just have to wait to see what happens.


Thanks anyway,


AB
Re: Loading images into Flash via ActionScript Rothrock
8/10/2005 12:00:00 AM
Re: Loading images into Flash via ActionScript AquaBoogie
8/10/2005 12:00:00 AM
That I can't argue with. I thought I might be able to get a head start since this is something we are doing here at the gig.

Thanks again for the feedback.


AddThis Social Bookmark Button