A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 41

Thread: Maximum of loaded png's with alpha channel in attached MovieClips?

  1. #1
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197

    Question 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!

    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!

    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!
    Toine Kamps | Design & Coding
    toinekamps.com

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    im not sure..

    but off the top of my head.. I say any loading of images or creating or empty movieClips should be done NOT on a depth of 0..

    maybe thats the problem?

    var pngHolder = pmc[i].createEmptyMovieClip("pngHolder", pmc[i].getNextHighestDepth());

  3. #3
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    var pngHolder = pmc[i].createEmptyMovieClip("pngHolder", pmc[i].getNextHighestDepth());
    Thanks for your reply Whispers!
    But that's what I thought too and I tried that allready but it doesn't make any difference unfortunately.
    I also tried (without any luck):
    Actionscript Code:
    pmc[i].attachMovie(phit[i], "hit", pmc[i].getNextHighestDepth());
    The weird thing is when it starts loading the XML and attaching the images the 2 first images DO show up for a second,
    but as soon as it's finished loading all of the images, they dissapear again.
    Toine Kamps | Design & Coding
    toinekamps.com

  4. #4
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    hmm..

    that is odd.

    try it single once...

    see if its a var or instance or depth or something that is not being parse/updated correctly.

    actually.. I still think it may be with your depths?


    these lines:

    pmc[i] = projects.createEmptyMovieClip(phit[i], i);

    var pngHolder = pmc[i].createEmptyMovieClip("pngHolder", 0);

    pmc[i].attachMovie(phit[i], "hit", 1);


    at one point will start overwriting each other.. as " i " will be both 0 & 1 in the beginning.. (your two blinking images?)


    change them all to: getNextHighestDepth() or something for a quick test.

  5. #5
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    actually.. I still think it may be with your depths?
    Yeah that was my guess too, but how?
    I changed the lines into:
    Actionscript Code:
    pmc[i] = projects.createEmptyMovieClip(phit[i], projects.getNextHighestDepth());
    var pngHolder = pmc[i].createEmptyMovieClip("pngHolder", pmc[i].getNextHighestDepth());    
    pmc[i].attachMovie(phit[i], "hit", pmc[i].getNextHighestDepth());
    but the same thing happens, even when remove the last line, so it must got something to do with the pngHolder part?
    Thanks!
    Toine Kamps | Design & Coding
    toinekamps.com

  6. #6
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    can you upload an AS3, AS2.0 version so I can peek at it?

    would be easier to test if all the needed objects are already in the library..etc

    (and some of the some sample images to load too?)

    just a .fla with this code
    .xml
    images
    AS2.0
    and AS3 compatible

    and I can try to de-bug with ya! =)

  7. #7
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    can you upload an AS3, AS2.0 version so I can peek at it?
    Yeah offcourse, but only in AS2.0 I'm afraid...
    I will strip down my fla to the essentials and attach the images with it, hold on!
    Thanks

    edit: I send you a message with a download link in it
    Let's see if we can crack this one!
    Last edited by Twandeman; 01-18-2011 at 06:09 AM.
    Toine Kamps | Design & Coding
    toinekamps.com

  8. #8
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    lol..

    sorry that was a typo.. I meant CS3.. AS 2.0

    I'll take a peek at it when I get to work today..

  9. #9
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    I'll take a peek at it when I get to work today..
    Hi again, did you get the chance to have a look at my files?
    Thank you!
    Toine Kamps | Design & Coding
    toinekamps.com

  10. #10
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    DOH!..

    I totally forgot about this!.. (sorry)

    I got email about PM..and without the email to remind me I had somethign aiting.. slipped my mind!

    I'll see if I get some time to look at it after lunch today.. (leaving in 30)

  11. #11
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    I'll see if I get some time to look at it after lunch today..
    Sorry to bug you again, I was just wundering if you were able to reproduce my problem?
    Thanks!
    Toine Kamps | Design & Coding
    toinekamps.com

  12. #12
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    got it now.. sorry busy week ...then birthday weekend.. really havent had much free time lately..

    looking at it in a few minutes..

  13. #13
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    sorry
    No worries mate, was just checking... maybe you forgot again
    It's still driving me nuts
    Toine Kamps | Design & Coding
    toinekamps.com

  14. #14
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    (not sure where my post went)


    but I loaded it.. and it doesnt 'do' anything..

    I see the buildings.. I can rollover them..

    you seem to attach a clip on the stage..(momentarily)

    then attach it to the mouse pointer/drag..


    but thats all it does? I can seem to find out what is supposed to be loaded to the

    also what is this:
    mapListener.stopLoad = function(){

    what what is supposed to be for? I dont even see it called or used anywhere else??

  15. #15
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Yeah I know, forget about the attached clip and the mapListener.stopLoad function, I tried to strip everything out, but forgot those...

    If you rollover on one of the buildings, are there 2 more buildings that suddenly appear in the top left corner?
    Toine Kamps | Design & Coding
    toinekamps.com

  16. #16

  17. #17
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    nope..only the tool tips..
    Could you be so kind to make a screenshot of your output?
    Here's mine:



    As you can see the first 2 buildings are just not there, as soon as I rollover on one of the buildings, they suddenly show up!
    Thanks for your time!
    Toine Kamps | Design & Coding
    toinekamps.com

  18. #18
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    oh..I see now.

    well those buildings are there when it LOADS.. (hence the reason I didnt see anythign load when I rolled over anything...they were already there)

  19. #19
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    well those buildings are there when it LOADS
    So you do have the same problem then?
    I don't get it...
    Toine Kamps | Design & Coding
    toinekamps.com

  20. #20
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    I thought they were NOT supposed to load..until I rolled over anything?


    (and that was working fine)..


    until you rolled over a few of them..then they disappeared?

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