Jump to content
Search Community

vyger

Members
  • Posts

    15
  • Joined

  • Last visited

Posts posted by vyger

  1. Hi Carl, I've no time to extract a working sample: anyway THAT code is all the code involved in this issue.

    I think this is an overwrite issue: I gave a look to the OverwriteManager but I have no time to understand and solve this issue. So, I asked my boss to change that behavior to direct alpha assignment (without tweening) and, dued to lack of time, he said it's ok. I'll back into this when it is possible. Thank you.

  2. Hi Carl, and thanks for your reply. The ROLL_OVER/OUT correction does not change the situation.

    Furthermore, I can't post a zip because this code is contained in a huge project (and, most of all, I've no permission to send it before it is gone online).

     

    Anyway, I can extract for you the manageMenu body:

     

    public function manageMenu(e:MouseEvent):void

    {

    var targetItem = e.currentTarget.getChildByName("icon_mc");

    // this SHOULD work but if MOUSE_OVER/OUT Events are set it doesn't. If you click 2 times it works again!...

    // I tried killing the tweens of targetItem but I had no luck

    TweenLite.to(targetItem,0.3,{alpha:1});

    //

    var iC = menuContainer.getChildByName("itemsContainer") as MovieClip;

    var menuContainerChildrenTotal = iC.numChildren;

    // every menuItem that is not the one we click fades out

    for (var i:uint = 0; i < menuContainerChildrenTotal; i++)

    {

    var children = iC.getChildAt(i);

    var childrenName = children.name;

    if (targetItem.parent.name != childrenName)

    {

     

    TweenLite.to(children.getChildByName("icon_mc"),0.3,{alpha:0.3});

    }

    }

    //

    TweenLite.to(dragger,0.5,{x:pt.x,alpha:1});

    }

     

    Thank you very much!

     

     

    [EDIT] It happens with the native Tween too! If you directly set the alpha (eg. alpha=1) it doesn't happen. I think there's some conflict but killTweensOf doesn't solve the situation.

  3. Hi, in a Flash project I've some buttons in a menu and I dinamically set their behavior:

     

    mc.addEventListener(MouseEvent.MOUSE_OVER,fadeIn);
    mc.addEventListener(MouseEvent.MOUSE_OUT,fadeOut);
    mc.addEventListener(MouseEvent.MOUSE_DOWN,manageMenu);

     

    Every button contains an icon: onMouseOver the icon fades in, onMouseOut fades out, the manageMenu function features a fadeIn ONLY for the item clicked (a loop is used, etc.).

     

    The fade code is fundamentally similar to this one:

     

    var targetItem = e.currentTarget.getChildByName("icon_mc");

    TweenLite.to(targetItem,0.2,{alpha:0.3});

     

    But what happens. When I remove MOUSE_OVER and MOUSE_OUT events, the manageMenu method works almost perfectly. But when I add the MOUSE_OVER and MOUSE_OUT, when I click the menu icon, the icon doesn't fade in anymore and I can't understand why. I think it could be something related to the library TweenLite because if I comment the relative code in the body of the fadeIn/fadeOut methods the manageMenu method works again.

     

    Any help is appreciated.

  4. Hi, I use this code inside a method to load an image:

     

    imageCounter++;
    var obj = {name:"loader" + imageCounter,onComplete:completeHandler,onProgress:progressHandler};
    var img = new ImageLoader(asset,obj);
    img.load();

     

    If one image is loading, is it possible to prevent the user from loading another image in the same container (aside from disabling the menu, that I just do)?

     

    Thanks.

  5.  

     

    zip attached. note I removed the loaderContainer_mc and its children from the fla stage.

     

    I didn't consider how it would hold up to a quick-click-load situation as greensock had pointed out. perhaps you can pick up a tip or two from each of our approaches. (his is probably better)

     

     

     

    Hi Carl, thanks very much for taking the time to test, modify the sample and reply. I'm playing with it and it works like a charm. :-)

  6. If I were building this from the ground up, I'd probably structure things a bit differently to make it more flexible and streamlined, but it works :) Like probably wouldn't use containers and a single mask because what if the user clicks very fast and more than one image is in the process of transitioning in? I'd create a distinct mask for each image and then dump it once the image is finished transitioning. Anyway, I hope this helps.

     

     

     

    First of all, thanks for your patience and code. I'm the "data guy", so I don't generally feel very comfortable with masks and graphics.

    Anyway, in my case the "very fast click" is disabled: when a user clicks a menu item, all the menu is disabled until the image gets totally loaded. The website has many different menus and every menu behaves this way.

  7. Hi, this post requires attention and patience, so if you're not in the right "mood", please skip it ;-)

     

    I must load several images:

    when an image is fully loaded, using a mask and a tween, I cover the preceding image loaded, so that if I originarily loaded 1.jpg, when the loading of 2.jpg is complete a mask starts covering 1.jpg at the same time and fully showing 2.jpg. When the tween is complete it should be UNLOADED 1.jpg and its container, empty again, should change its index inside the main container (it should get an higher value while waiting for the next image to load).

     

    So, I created a container for two MovieClip loaders (they act as image loaders and containers) that in my intentions should, as I said, swap their indexes: the container's name is loaderContainer_mc. Inside this container there are two empty MovieClip loaders, loader0_mc and loader1_mc.

     

    The following is all the code: very few lines, but I don't undestand what's going on because for some reason I can't get this simple test working.

     

    import com.greensock.*;
    import com.greensock.loading.*;
    import com.greensock.events.LoaderEvent;
    import com.greensock.loading.display.*;
    import com.greensock.easing.Back;
    import flash.events.MouseEvent;
    //
    var images = ["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg"];
    //
    var counter = 1;
    var currentLoaderNum = 1;
    [b]// when you press the button a new image should be loaded[/b]
    btn.addEventListener(MouseEvent.MOUSE_DOWN,LOAD);
    var queue;
    //;
    function LOAD(e:MouseEvent)
    {
           // 
    loadTester(images[counter],currentLoaderNum, "loader"+currentLoaderNum);
    counter++;
    }
    //
    loadTester(images[0],currentLoaderNum, "loader"+currentLoaderNum);
    //
    function loadTester(imagePath, currentLoaderNum, loaderName)
    {
    trace("currentLoaderNum:"+ currentLoaderNum);
    trace("loader: "+loaderName);
    trace("mc loader: "+"loader"+currentLoaderNum+"_mc");
    //
    queue = new LoaderMax({name:"q",onProgress:progressHandler,onComplete:completeHandler,onError:errorHandler});
    queue.append( new ImageLoader(imagePath, {name:loaderName, container:loaderContainer_mc.getChildByName("loader"+currentLoaderNum+"_mc")}) );
    queue.load();
    }
    
    function progressHandler(event:LoaderEvent):void
    {
    //trace("progress: " + event.target.progress);
    }
    
    function completeHandler(event:LoaderEvent):void
    {
    trace("loader0_mc width: "+loaderContainer_mc.getChildByName("loader0_mc").width+"***");
    trace("loader1_mc width: "+loaderContainer_mc.getChildByName("loader1_mc").width+"***");
    trace("loader0_mc index: "+loaderContainer_mc.getChildIndex(loaderContainer_mc.getChildByName("loader0_mc"))+"***");
    trace("loader1_mc index: "+loaderContainer_mc.getChildIndex(loaderContainer_mc.getChildByName("loader1_mc"))+"***");
    //
    var image:ContentDisplay = LoaderMax.getContent("loader" + currentLoaderNum);
    //
    image.mask = mask2_mc;
    //
    TweenLite.to(mask2_mc, 3, {height:375, ease:Back.easeOut});
    trace(event.target + " loaded");
    // the mask is reduced
    mask2_mc.height = 1;
    // 
    var num = currentLoaderNum == 0 ? 1:0;
    currentLoaderNum = num;
    //
    if (loaderContainer_mc.getChildByName("loader" + num + "_mc").width > 0)
    {
    	LoaderMax.getLoader("loader" + (num)).unload();
    	trace(LoaderMax.getLoader("loader" + (num)));
    }
    
    var temp = loaderContainer_mc.getChildByName("loader" + currentLoaderNum + "_mc");
    //
    loaderContainer_mc.setChildIndex(temp,loaderContainer_mc.numChildren-1);
    //
    trace("loader0_mc index: "+loaderContainer_mc.getChildIndex(loaderContainer_mc.getChildByName("loader0_mc"))+"***");
    trace("loader1_mc index: "+loaderContainer_mc.getChildIndex(loaderContainer_mc.getChildByName("loader1_mc"))+"***");
    trace("__________________________________________________________________");
    }
    
    function errorHandler(event:LoaderEvent):void
    {
    trace("error occured with " + event.target + ": " + event.text);
    }

     

    What happens: this code:

    1. doesn't unload the previous image when the tween on the most recent ends;

    2. doesn't show the previous image while the tween is executing;

     

    What am I doing wrong?

    To facilitate you, I post a temporary link to a folder with the code (images and library are provided):

    https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B1EWtqLO5hiWNDE4NDg4ZmEtMWI4Yy00NDY2LTkwMTktMTkxMWVhNTkzNWY2&hl=en_US

    (you'll find a list of files: from the upper left menu click File > Download original to get the zip).

     

    Thanks in advance.

     

    EDIT: I found I can load any image I want in a single clip: this way problem 2 would be solved. It'd remain problem 1: if I load multiple images inside the same movieclip, how do I delete them? I tried unload and dispose but they seem to unload anything contained in the movieclip. This one is working:

     

    if (myclip.numChildren > 2)
    {
    	trace(myclip.getChildAt(0).name);
    	myclip.removeChild(myclip.getChildAt(0));
    }

     

    but is there any LoaderMax-way to perform this action?

  8. Hi, thanks for your reply: of course now I have a working com folder (and of course I tried what you suggest before posting).

     

    I investigated further the differences between the two folders.

    The changelog header is the same:

     

    CHANGE LOG : GREENSOCK TWEENING PLATFORM

    ----------------------------------------

    2011-07-07

    ---------------------------------------------

    TweenLite 11.63

    TweenMax 11.69

     

    but three folders have different size:

     

    events (20 kb in my version, 12 in yours)

    loading (815 kb / 803 kb)

    plugins (205 kb / 188 kb)

     

    Anyway, no problem, your platform is stellar. :-)

     

    Vyger

  9. Hi, your files are ok: anything works fine. The only difference is (very strange this one) your com folder is 1.7 Mb with 112 elements, while mine is 1.8 Mb with 112 elements. I downloaded the files three days ago from GreenSock website. Could it be a version issue?

  10. Hi Carl, thanks for your kind reply.

     

    I created a new FLA and I simply copied and pasted your code in the first frame.

    The FLA (and the swf) is located in a folder where I have the minumum elements required (I suppose): an image ('photo1.jpg') and the com folder.

     

    I compile and I get:

     

    error 1137: Incorrect number of arguments. Expected no more than 1.

     

    Line 6:

    var loader:ImageLoader = new ImageLoader("photo1.jpg",{name:"photo1",container:this,x:180,y:100,width:200,height:150,scaleMode:"proportionalInside",centerRegistration:true,onComplete:onImageLoad});

     

    error 1061: Call to a possibly undefined method load through a reference with static type ImageLoader.

     

    Line 9:

    loader.load();

     

    I must say I tried the same test before posting, with the same result. Oh! I commented the lines about doc.xml etc. because I did not need them (I only wanted to load an image).

     

    Another thing: this is not the only thing not working. I got the first error when trying the large piece of code I found in the middle of this page: http://www.greensock.com/loadermax/

    Then I reached the reference page and found the code I posted (and it did not work too)...

  11. Hi, I copied some code from the reference, in particular I copied and pasted this code in the first frame of my FLA (Ide: Flash CS5, OS: MacOS):

     

    import com.greensock.*;
    import com.greensock.events.LoaderEvent;
    import com.greensock.loading.*;
    
    //create an ImageLoader: THROWS ERROR
    var loader:ImageLoader = new ImageLoader("photo1.jpg",{name:"photo1",container:this,x:180,y:100,width:200,height:150,scaleMode:"proportionalInside",centerRegistration:true,onComplete:onImageLoad});
    
    //begin loading: THROWS ERROR
    loader.load();
    
    //when the image loads, fade it in from alpha:0 using TweenLite;
    function onImageLoad(event:LoaderEvent):void
    {
    TweenLite.from(event.target.content, 1, {alpha:0});
    }
    
    //Or you could put the ImageLoader into a LoaderMax. Create one first...
    var queue:LoaderMax = new LoaderMax({name:"mainQueue",onProgress:progressHandler,onComplete:completeHandler,onError:errorHandler});
    
    //append the ImageLoader and several other loaders: THROWS ERROR
    queue.append( loader );
    //queue.append( new XMLLoader("xml/doc.xml", {name:"xmlDoc", estimatedBytes:425}) );
    //queue.append( new SWFLoader("swf/main.swf", {name:"mainClip", estimatedBytes:3000, container:this, autoPlay:false}) );
    
    //start loading
    queue.load();
    
    function progressHandler(event:LoaderEvent):void
    {
    trace("progress: " + queue.progress);
    }
    
    function completeHandler(event:LoaderEvent):void
    {
    trace(event.target + " is complete!");
    }
    
    function errorHandler(event:LoaderEvent):void
    {
    trace("error occured with " + event.target + ": " + event.text);
    }

     

    This one throws three errors: 1137, 1061 and 1067.

    Everything seems very easy: what am I doing wrong?

     

    Thanks in advance.

×
×
  • Create New...