Maximum of loaded png's with alpha channel in attached MovieClips?
Hi there,
I'm having a problem which is driving me nuts!
On my stage I have 2 empty MC holders, each of them in a seperate layer.
In the bottom mc holder called 'map' a map image is loaded from my XML file using MovieClipLoader. This works fine.
What I want to achieve is that on top of the map, 24 PNG images with Alpha channels are loaded into seperate MovieClips attached in MC holder 'projects'.
For every PNG image a MovieClip from my library is attached in order to determine the hit shape of the PNG image. This works fine too!
However all of sudden my first 2 MovieClips with the PNG images in it dissapear as soon as all of the images are loaded.
But when I roll over on of the other MovieClips they suddenly show up again and when rolling out they dissapear again! :confused:
It has nothing to do with my XML file nor my PNG images, because when I move my first 2 XML nodes (the ones that are dissapearing) to the end, 2 different MovieClips dissapear!
It worked absolutely fine before but since I added 2 more MovieClips the problems started.
It almost looks like I can't load more then 22 PNG images, but that would be extremely weird.
I tried creating the first half of the MovieClips in one MovieClip and the second half in a different MovieClip, but that doesn't change anything.
But when I create the first half of the MovieClips in the _root and the second half in a MovieClip, only 1 MovieClip dissapears instead of 2! :confused:
I really don't get it. I'm totally confused and lost since I don't know what else I could try.
Can anyone have a look at my code, maybe one of you sees a glitch. Thanks for your time anyway!
Here's my AS2 code:
Actionscript Code:
var pimage = new Array();
var pmc = new Array();
var ptitle = new Array();
var phit = new Array();
var ptooltip = new Array();
var pmenu = new Array();
var ptotal:Number;
var phalf:Number;
function fillProjects() {
nodepath = myXML.firstChild.childNodes[1];
ptotal = nodepath.childNodes.length;
phalf = Math.round(ptotal/2);
var pLoader:MovieClipLoader = new MovieClipLoader();
var pPreloader = new Object();
pLoader.addListener(pPreloader);
for (i=0; i<ptotal; i++) {
// Fill projects on map
pimage[i] = nodepath.childNodes[i].childNodes[0].firstChild.nodeValue;
ptitle[i] = nodepath.childNodes[i].attributes.label;
phit[i] = nodepath.childNodes[i].childNodes[1].firstChild.nodeValue;
ptooltip[i] = nodepath.childNodes[i].childNodes[2].firstChild.nodeValue;
pmenu[i] = nodepath.childNodes[i].attributes.label;
pmc[i] = projects.createEmptyMovieClip(phit[i], i);
var pngHolder = pmc[i].createEmptyMovieClip("pngHolder", 0);
pLoader.loadClip(pimage[i], pngHolder);
pPreloader.onLoadStart = function(target) {
target._alpha = 0;
}
pPreloader.onLoadComplete = function(target) {
var fadeInTween:Tween = new Tween(target, "_alpha", Strong.easeInOut, target._alpha, 100, 8, false);
};
// Functions
pmc[i].attachMovie(phit[i], "hit", 1);
pmc[i].hit.id = i;
pmc[i].hit.onRelease = function() {
this._parent.filters = [];
showDetails(this.id);
};
pmc[i].hit.onRollOver = function() {
var glow:GlowFilter = new GlowFilter(0xFFFFFF, 0.5, 10, 10, 5, 5);
var filtersArray:Array = new Array(glow);
this._parent.filters = filtersArray;
showTooltip(this.id);
};
pmc[i].hit.onRollOut = function() {
this._parent.filters = [];
hideTooltip();
};
}
}
mapImage = myXML.firstChild.childNodes[0].firstChild.nodeValue;
mapLoader.loadClip(mapImage, map.placeholder);
fillProjects();
My XML structure looks like this:
PHP Code:
<map>content/map.jpg</map>
<projects>
<project1 label="Project 1">
<image>content/project1.png</image>
<hit>project1</hit>
<image>content/project1_tt.jpg</image>
</project1>
<project2 label="Project 2">
<image>content/project2.png</image>
<hit>project2</hit>
<image>content/project2_tt.jpg</image>
</project2>
.... etc
</projects>
Any help is appreciated!