A Flash Developer Resource Site

Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 41

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

  1. #21
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    I thought they were NOT supposed to load..until I rolled over anything?
    Haha, no I wish No, they ARE supposed to load!
    That's why it's so weird don't you agree?
    Quote Originally Posted by whispers View Post
    until you rolled over a few of them..then they disappeared?
    No, when the loading off ALL the buildings is finished, the first 2 buildings in the XML file (in this example the 2 in the top left corner) simply dissappear.
    You can test it by simulating download when publishing the movie.
    Toine Kamps | Design & Coding
    toinekamps.com

  2. #22
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    ok..let me look again..

    and whats this:

    mapListener.stopLoad = function(){
    if(this.loadStarted) {
    this.mcl.unloadClip(this.mc);
    } else {
    this.stopOnStart = true;
    }
    }

    you have code/functions not being called or used anywhere?

    just trying to weed through the code..


    I guess I just understand your approach here or what it is your doing..


    imho..I would strip out everything.. all these tweens..extra vars..etc until you get a base load & rollover working..



    I dont see anything in the code that would stop these from showing up even?


    ok..I believe I have re-worked the code (my way) and can now follow along with what you want.. (if you want any tweening..etc you can add it back in later).. I also suggest you use Tweenmax for ANYTHING tween related.. its super easy, cool and way faster than anything else!!

  3. #23
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    ok.. so lets start over.. I have the XML loading..

    I have your images loading in their blank/empty clips..

    I have the hit clips/buttons being attached into/above those images.. so you can have rollovers..etc..

    lets start from there..

    I 'think' I have all images (buildings loading)..

    so what do we want to do from here.. I dont see any building 'disappear'..

  4. #24
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    I dont see them disappearing at all...

    rollovers work..

    initial building load/placement is fine..

    not sure where you need me to go from here..

    here is my final (tweaked) code:

    actionscript Code:
    import flash.display.*;
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    import flash.filters.GlowFilter;
    Stage.scaleMode = "noScale";

    var projectArray:Array = new Array();

    //map code
    map.createEmptyMovieClip("placeholder",map.getNextHighestDepth());

    var mapListener:Object = new Object();
    var mapLoader:MovieClipLoader = new MovieClipLoader();

    mapListener.stopOnStart = false;
    mapListener.loadStarted = false;
    mapListener.mc = map.placeholder;
    mapListener.mcl = mapLoader;

    mapListener.stopLoad = function() {
        if (this.loadStarted) {
            this.mcl.unloadClip(this.mc);
        } else {
            this.stopOnStart = true;
        }
    };
    mapListener.onLoadStart = function(target_mc:MovieClip) {
        if (this.stopOnStart) {
            this.mcl.unloadClip(target_mc);
        } else {
            this.loadStarted = true;
        }
        preloader._visible = true;
    };
    mapListener.onLoadComplete = function(target_mc:MovieClip) {
        preloader._visible = false;
    };

    mapListener.onLoadInit = function() {
        this.mc.forceSmoothing = true;
    };
    //add map listener
    mapLoader.addListener(mapListener);


    //load xml
    var myXML = new XML();
    myXML.ignoreWhite = true;
    myXML.onLoad = function(success) {
        if (success) {
            //load map image
            map_image = myXML.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
            mapLoader.loadClip(map_image,map.placeholder);

            showProjects();
        } else {
            trace("XML not loaded");
        }
    };
    myXML.load("content/content.xml");


    /* --------------------------------------------------------------------------------
    PROJECT
    ---------------------------------------------------------------------------------*/



    function showProjects() {
        // Get buildings node
        nodepath = myXML.firstChild.childNodes[1].childNodes[4].childNodes[0].childNodes[1];
        //total buildings
        ptotal = nodepath.childNodes.length;

        var pLoader:MovieClipLoader = new MovieClipLoader();
        var pPreloader = new Object();
       
        pPreloader.onLoadStart = function(target) {
            trace("load started......");
        };
        pPreloader.onLoadInit = function(target) {
            trace("load complete.......");
           
            var addHit = target._parent.attachMovie(target._parent._name, "hit", target._parent.getNextHighestDepth());

            addHit.onRollOver = function() {
                trace("ID CHECK: " + this._parent.id);
                showTooltip(this._parent.id);
            };
            addHit.onRollOut = function() {
                hideTooltip();
            };
            addHit.onRelease = function() {
                //showDetails(this._parent..id);
            };
        };
        //add listener
        pLoader.addListener(pPreloader);

        for (i = 0; i < ptotal; i++) {
            //declare vars
            var pimage = nodepath.childNodes[i].childNodes[0].firstChild.nodeValue;
            var ptitle = nodepath.childNodes[i].attributes.label;
            var phit = nodepath.childNodes[i].childNodes[1].firstChild.nodeValue;
            var ptooltip = nodepath.childNodes[i].childNodes[2].firstChild.nodeValue;
            var pmenu = nodepath.childNodes[i].attributes.label;
            var pstatus = nodepath.childNodes[i].attributes.status;
            var prent = nodepath.childNodes[i].attributes.rent;
            var pmc = projects.createEmptyMovieClip(phit, projects.getNextHighestDepth());
            var imageHolder = pmc.createEmptyMovieClip("imageHolder", pmc.getNextHighestDepth());

            projectArray.push({pimage:pimage, ptitle:ptitle, phit:phit, ptooltip:ptooltip, pmenu:pmenu, pstatus:pstatus, prent:prent, pmc:pmc, imageHolder:imageHolder});

            var targetClip = eval(projectArray[i].pmc);
            targetClip.id = i;
           
            pLoader.loadClip(projectArray[i].pimage,projectArray[i].imageHolder);
           
            //trace("TARGET CLIP ID: " + targetClip.id);
            //trace("ID CHECK OG: " + projectArray[i].pmc.id + newline);
        }  
    }


    /* --------------------------------------------------------------------------------
    TOOLTIP
    ---------------------------------------------------------------------------------*/

    function showTooltip(id:Number) {
        // Attach Tooltip
        if (_root._xmouse < 490) {
            tooltip_holder.attachMovie("tooltip_right","tooltip",tooltip_holder.getNextHighestDepth());
        } else {
            tooltip_holder.attachMovie("tooltip_left","tooltip",tooltip_holder.getNextHighestDepth());
        }
        //update initplacement
        tooltip_holder.tooltip._x = _root._xmouse;
        tooltip_holder.tooltip._y = (_root._ymouse) - 25;
       
        // Follow Mouse
        mylistener = new Object();
        mylistener.onMouseMove = function() {
            tooltip_holder.tooltip._x = _root._xmouse;
            tooltip_holder.tooltip._y = (_root._ymouse) - 25;
            updateAfterEvent;
        };
        Mouse.addListener(mylistener);

        tooltip_holder.tooltip.info.kop.htmlText = projectArray[id].ptitle.toUpperCase();

        var tooltipLoader:MovieClipLoader = new MovieClipLoader();
        var tooltipListener = new Object();
        tooltipLoader.addListener(tooltipListener);
        tooltipListener.onLoadInit = function(target) {
            scaleThumbs(target,100,70);
        };
        tooltipLoader.loadClip(projectArray[id].ptooltip,tooltip_holder.tooltip.info.picholder);
    }

    // Hide tooltip
    function hideTooltip() {
        Mouse.removeListener(mylistener);
        tooltip_holder.tooltip.removeMovieClip();
    }

  5. #25
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    I dont see them disappearing at all...
    rollovers work..
    initial building load/placement is fine..
    not sure where you need me to go from here..
    Really? You got to be kidding me... Even with your code, the first 2 buildings still dissapear!
    So to be absolutely clear: the 2 buildings in the image in my previous post with the red circle around it ARE visible in your movie when you export?
    I tried this on 2 different machines in Flash CS4 and they just dissapear when all the buildings are fully loaded???
    Toine Kamps | Design & Coding
    toinekamps.com

  6. #26
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    although I 'see' it as one building/image.. yes whatever it is you circled in yoru pic.. is there..

    was in your code.. and still is in mine.

    I dont need to simulate download anything.. if it loads and is visible..there is no reason to doubt it..

    simulating download speed (reduced loading).. is where you can get errors/bugs

    Im on WinXP

    CS3


    I re-worked the code to be easier/cleaner to follow.. and still get the same results..

    works for me.. from what I understand I am to be looking for.

  7. #27
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    works for me.. from what I understand I am to be looking for.
    I'm sorry you must think I'm crazy by now...
    But this is very frustrating because in CS4 on a Mac they are just NOT there
    Quote Originally Posted by whispers View Post
    I dont need to simulate download anything.. if it loads and is visible..there is no reason to doubt it..
    No I know, but when I simulate the download they DO appear for a second, so I'm positive it has nothing to do with the images
    I just opened the file in CS4 on Windows XP and the same freaking problem occurs!
    Last edited by Twandeman; 01-26-2011 at 03:03 PM.
    Toine Kamps | Design & Coding
    toinekamps.com

  8. #28
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Okay I found the problem! It's some sort of bug/limitation in Flash CS4
    I saved as CS3 and opened my file in CS3, exported and voilá: no problem whatsoever! I knew I'm not crazy
    But should I move my thread then? Because in the thread prefix I can't choose CS4 (it goes up to CS3)
    Very weird....
    Toine Kamps | Design & Coding
    toinekamps.com

  9. #29

  10. #30
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    glad it worked out for you..
    Sorry to bug you again, but it didn't worked out for me yet...
    I did however managed to reproduce the problem/bug in CS3, but in CS4 the problem still occurs.

    What I did: on top of the layer with the buildings in it I created a new layer with some simple buttons in it and that's where the problems start!
    If I hide that new layer in CS3 and export the movie: no problem
    If I show that layer in CS3 and export the movie those 2 buildings dissapear again!
    In CS4 it doesn't even matter if I hide or show that layer, those 2 buildings dissapear anyway!

    In my Flash file in the downloadlink you can test it yourself by hiding/showing the layer and export the movie.
    Download debug files

    Could you please have one more look because I'm going insane
    Many thanks!
    Toine Kamps | Design & Coding
    toinekamps.com

  11. #31

  12. #32
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    ok... have you done anything to the project besides have so ePNG's over the project?

    I dont wanna have to go through your project (again) strip out the code that isnt needed.. condense things to make it smoother (all over again).. remove tweens which seem to take forever to do anything...etc..etc..etc

    Id rather just use the code I provided which I am familiar with no extra 'tween code' and it straight to the point.. you can goo back and add the bells & whistles later..

    anyways.. it seems that if I click on the stage. they show..click again..they hide..etc

    (who knows.. the tween stuff was just lagging)

    so if all you've done is add some png's to a layer above everything.. I'll do the same in my version and test

  13. #33

  14. #34
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    I dont wanna have to go through your project (again) strip out the code that isnt needed.. condense things to make it smoother (all over again).. remove tweens which seem to take forever to do anything...etc..etc..etc

    Id rather just use the code I provided which I am familiar with no extra 'tween code' and it straight to the point.. you can goo back and add the bells & whistles later..
    Sorry you're right, I replaced my code with the one you provided and replaced the file in my download link.
    Quote Originally Posted by whispers View Post
    so if all you've done is add some png's to a layer above everything.. I'll do the same in my version and test
    No not png's, just some simple movieclips
    Quote Originally Posted by whispers View Post
    what happened to your tooltip layer now?
    Stripped that out too, not relevant
    Thanks again!
    Toine Kamps | Design & Coding
    toinekamps.com

  15. #35
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    ok...

    I see what you mean now.

    I do think it may be something with .png's as well...

    "I" myself have never run into this because,... while I use .png's exclusively!!..

    I do NOT make them full size images like you are doing.... which is basically like a stack of papers on top of one another..

    (lots of layers.. and lots of trans/alpha data to deal with)..

    which "I" now believe is leading to your problems.

    my suggestion (which may be too much work at this point)..

    is make each building an image like it is now.. not ONLY as big as it has to be.. not a FULL IMAGE the size matchign you stage so things align correctly..

    but put the X&Y coords in an XML file..and position like..

    I can help you whip it up real quick if you like..

    (you'll have to do the image work though) =)

  16. #36
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    ok...

    I see what you mean now.

    I do think it may be something with .png's as well...

    "I" myself have never run into this because,... while I use .png's exclusively!!..

    I do NOT make them full size images like you are doing.... which is basically like a stack of papers on top of one another..

    (lots of layers.. and lots of trans/alpha data to deal with)..

    which "I" now believe is leading to your problems.
    Yeah that's what I think too, but I tried to replace the .png's with transparant .gif's and it's the same problem!
    If you put this line:
    Actionscript Code:
    myXML.load("content/gif.xml");
    You can see for yourself, I also tried with .jpg's but then I obviously can't really 'see' if it's the same problem...

    Quote Originally Posted by whispers View Post
    my suggestion (which may be too much work at this point)..

    is make each building an image like it is now.. not ONLY as big as it has to be.. not a FULL IMAGE the size matchign you stage so things align correctly..

    but put the X&Y coords in an XML file..and position like..

    I can help you whip it up real quick if you like..

    (you'll have to do the image work though) =)
    Yeah, that could be a solution, but I gotta run in a minute so I can't try it right now. I'm glad you see my problem now
    Thanks a lot, will get back to you tomorrow!
    Toine Kamps | Design & Coding
    toinekamps.com

  17. #37
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    I believe your approach in general (doesnt matter .gifs or .pngs) is 'flawed' so to speak..

    while you are using a .png of the building only(per se`)..

    the .png is actually the WHOLE size of the flash movie/stage.... with the rest of the image/space is 'transparent'...

    which in my opinion is the problem.

  18. #38
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    which in my opinion is the problem
    I still think it's weird that causes so much problems...
    It's not documented anywhere that you can't put more then 22 transparant images on top of each other in Flash...
    Wel I'm gonna give your suggestion a shot right now
    Toine Kamps | Design & Coding
    toinekamps.com

  19. #39
    Twansparant Twandeman's Avatar
    Join Date
    May 2004
    Location
    Amsterdam
    Posts
    197
    Quote Originally Posted by whispers View Post
    which in my opinion is the problem
    It was!
    Like you suggested I cropped the transparant images to the neccessary dimensions and added a x and y position for each building in my XML file.
    That solved it! Apparently Flash doesn't like it when you stack more then 20 transparant images on top of eachother... How was I suppose to know that?

    This is defenitely a solution for me, but it's less efficient for me. I made the png's the same dimensions as the stage so it would be easy to align them.
    Now I have to determine the coordinates of the building on the map first.

    Thanks for your time and patience with me!
    Cheers
    Toine Kamps | Design & Coding
    toinekamps.com

  20. #40
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    yeah getting the X & Y will be a bit of work.. maybe make a drag/drop app to get some near coords and tweak the xml from there..

    good luck.

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