Jump to content

emsee last won the day on March 27 2013

emsee had the most liked content!


  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by emsee

  1. I have three tweens, each one with a sound effect called on start:

    //simplified code:
    TweenMax.to(this, 10, {alpha:1, delay:1, onStart:playSound1});
    TweenMax.to(this, 10, {alpha:1, delay:2, onStart:playSound2});
    TweenMax.to(this, 10, {alpha:1, delay:3, onStart:playSound3});
    function playSound1():void
    function playSound2():void
    function playSound3():void

    I would like the sounds to overlap, but instead, the first sound is cut off by the second, which in turn is cut off by the third.


    Can I get all three sounds overlapping?


    Is there a way to access the loaded sound object & play it through a separate channel manually?




  2. Hi,


    Thanks for the update, it's really helpful.


    When I first tried it, I assumed it would set the number of repetitions to whatever value is passed. I guess it actually sets the current repetition (so if your repeat value is 3 and you set it to 1, it plays the loop twice more).


    Do you think it would be better to have two get/setters: One to set the repeat count & one to set the current repeat?


    Either way, I'm happy :)

  3. Hi,


    I have a simple problem, which I wondered if VideoLoader has a solution to. If not, I can achieve it manually, but thought I'd ask.


    I've got a simple video which repeats 3 times:

    vid = new VideoLoader("video.flv", {name:"vid", container:this, repeat:3});

    I call it like this:


    ...but this only works once. The second time I try to play it, it doesn't play.



    I tried calling it this way instead:


    ...but then it only plays once.



    Is there any way to maintain the repeat settings?

  4. Hello,


    I know it's possible to have mixed xml (with loader's and also other content), but I'm having trouble working out how to access XML in LoaderMax before child loaders have finished.


    For example, here's a simple version of my xml:

    <?xml version="1.0" encoding="utf-8"?>
            <LoaderMax name="..." prependURLs="assets/" load="true">
                <MP3Loader name="..." url="..." autoPlay="false"/>
                <ImageLoader name="..." url="..."/>
            <LoaderMax name="..." prependURLs="assets/" load="true">
                <SWFLoader name="..." url="..."/>
                <SWFLoader name="..." url="..."/>
    	<prompts>Some other content</prompts>


    All good so far. I get an onChildComplete event for each item loaded, plus one for each LoaderMax itself. Once everything is loaded, I get an onComplete event.




    I really need an event for the XML file itself. I can access it once everything else has loaded, but I really need to access it before the load has completed (I'm assuming it's the first thing loaded?).


    Is this possible?


    I really hope it is!

  5. That would be a great solution had I not foolishly obfuscated my actual goal!


    I'm actually working across two computers - so the example above is actually supposed to scroll a long image across two screens, passing seamlessly from one to the next.


    I think I managed to solve it though:


    var offset:int = 0;
    var numScreens:int = 8;
    var otherScreens:int = numScreens - 1;
    TweenMax.fromTo(blit, 2, { scrollX:(1 / otherScreens * offset) % otherScreens },
    { scrollX:1 + ((1 / otherScreens * offset) % otherScreens), ease:Linear.easeNone } );


    If you change the offset for each screen, that seems to do the trick


    (edit: and the BlitMask should wrap)

  6. Hi,


    If anyone is up for a challenge, I'm having real trouble with the scrollX settings for BlitMask.


    I'm trying to scroll the identical contents of two Blitmasks, placing them side-by-side and offsetting one.


    Here's an example class:


    import com.greensock.BlitMask;
    import com.greensock.easing.Linear;
    import com.greensock.TweenMax;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.text.TextField;
    import flash.text.TextFormat;
    public class Main extends Sprite
     private const W:int = 300;
     private const S:int = 350;
     private const C:int = 10;
     private var img1:Sprite;
     private var img2:Sprite;
     private var img3:Sprite;
     private var txt1:TextField;
     private var txt2:TextField;
     private var txt3:TextField;
     private var blit1:BlitMask;
     private var blit2:BlitMask;
     private var blit3:BlitMask;
     public function Main():void
      if (stage) init();
      else addEventListener(Event.ADDED_TO_STAGE, init);
     private function init(e:Event = null):void
      removeEventListener(Event.ADDED_TO_STAGE, init);
      // entry point
      img1 = new Sprite();
      img1.graphics.drawRect(0, 0, 3500, 200);
      txt1 = new TextField();
      txt1.text = "X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0"
      txt1.width = 1750;
      txt1.scaleX = txt1.scaleY = 1.9;
      txt1.setTextFormat(new TextFormat("Arial", 100, 0, true));
      img2 = new Sprite();
      img2.graphics.drawRect(0, 0, 3500, 200);
      txt2 = new TextField();
      txt2.text = "X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0"
      txt2.width = 1750;
      txt2.scaleX = txt2.scaleY = 1.9;
      txt2.setTextFormat(new TextFormat("Arial", 100, 0, true));
      img3 = new Sprite();
      img3.graphics.drawRect(0, 0, 3500, 200);
      txt3 = new TextField();
      txt3.text = "X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0"
      txt3.width = 1750;
      txt3.scaleX = txt3.scaleY = 1.9;
      txt3.setTextFormat(new TextFormat("Arial", 100, 0, true));
      blit1 = new BlitMask(img1, 0  , 0, 300, 200, false, true, 0, true);
      blit2 = new BlitMask(img2, 350, 0, 300, 200, false, true, 0, true);
      blit3 = new BlitMask(img3, 0, 200, 700, 200, false, true, 0, true);
      var b1_offset:int = 0;
      var b2_offset:int = 1;
      var b1_end:Number   = 1 - (W / S * C)
      var b2_start:Number = (W / S * C);
      TweenMax.fromTo(blit1, 10, { scrollX:0 }, { scrollX:b1_end, ease:Linear.easeNone } );
      TweenMax.fromTo(blit2, 10, { scrollX:b2_start }, { scrollX:1, ease:Linear.easeNone } );
      //need to match this:
      TweenMax.fromTo(blit3, 10, { scrollX:0 }, { scrollX:1, ease:Linear.easeNone } );


    So the aim is to make the contents of the top two BlitMasks match the third by offsetting the end position of blit1 (b1_end) and the start position of blit2 (b2_start).


    Only it doesn't work how I would expect & I can't get my head around it.


    Fabulous prizes to anyone who can help ;)

  7. Hi,


    I'm trying to add a wipe transition to an image that is being panned with Blitmask, but as the height of the blitmask changes, the scrollY is also changed. Is there a way to do this, or should I come up with a different way to do the wipe?


    Here's my code:

    blit = new BlitMask(image, 0, 0, 1920, 1080, false, true);
    blit.y = 1080;
    blit.height = 0;
    blit.scrollY = 0;
    var t:Array = new Array();
    t.push( new TweenMax(blit, 1, { y:0, height:1080, delay:startTime } ) );
    t.push( new TweenMax(blit, 10, { scrollY:1, delay:startTime } ) );
    t.push( new TweenMax(blit, 1, { height:0, delay:startTime + 8 } ) );
    score = new TimelineMax();