Jump to content
Search Community

solomania9

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by solomania9

  1. This chunk of code was working great in one JS file, but now I'm using the code in another project and it's giving me this error in Chrome:

    Draggable.js:2186 Uncaught TypeError: _unwrapElement(...).getBoundingClientRect is not a function

     

    The line in my code that's triggering the error is the line below, "if (this.hitTest..."

    function onDrag() {
        G.hitting = null;
        tile.positioned = false;
        for (var i = 0; i < G.tiles.length; i++) {
            if (this.hitTest(G.tiles[i], G.dragThreshhold)) {
                G.hitting = i;
            }
        }
        console.log("currently hitting "+G.hitting);
    }

    How do I go about troubleshooting this? I'm sure the error isn't actually in Draggable.js, but instead it has something to do with how my code is set up. FWIW, the code chunk in the broken page is identical to the code in the working page.

     

    I've tried changing the order the JS scrips that are being loaded on the page, but no luck.

     

    What are some other things I can try to troubleshoot this?

     

  2. I'm using this effect to create a rippling across a bunch of sequentially-named movie clips. There's clearly a more efficient way to loop through each mc, but I don't know how to loop inside timeline.appendMultiple. Any suggestions? Thanks so much!

     

    import com.greensock.*;
    import com.greensock.easing.*;
    
    var transtime = .5;
    function init() {
    var timeline:TimelineMax=new TimelineMax();
    timeline.appendMultiple([	new TweenLite(stripes2.b0, transtime, {alpha:randomRange(.1,1), onComplete:onFinishTween, onCompleteParams:[stripes2.b0]}),
    							new TweenLite(stripes2.b1, transtime, {alpha:randomRange(.1,1), onComplete:onFinishTween, onCompleteParams:[stripes2.b1]}),
    							new TweenLite(stripes2.b2, transtime, {alpha:randomRange(.1,1), onComplete:onFinishTween, onCompleteParams:[stripes2.b2]}),
    							new TweenLite(stripes2.b3, transtime, {alpha:randomRange(.1,1), onComplete:onFinishTween, onCompleteParams:[stripes2.b3]}),
    							new TweenLite(stripes2.b4, transtime, {alpha:randomRange(.1,1), onComplete:onFinishTween, onCompleteParams:[stripes2.b4]}),
    							new TweenLite(stripes2.b5, transtime, {alpha:randomRange(.1,1), onComplete:onFinishTween, onCompleteParams:[stripes2.b5]}),
    							new TweenLite(stripes2.b6, transtime, {alpha:randomRange(.1,1), onComplete:onFinishTween, onCompleteParams:[stripes2.b6]}),
    							new TweenLite(stripes2.b7, transtime, {alpha:randomRange(.1,1), onComplete:onFinishTween, onCompleteParams:[stripes2.b7]}),
    							new TweenLite(stripes2.b8, transtime, {alpha:randomRange(.1,1), onComplete:onFinishTween, onCompleteParams:[stripes2.b8]}),
    							new TweenLite(stripes2.b9, transtime, {alpha:randomRange(.1,1), onComplete:onFinishTween, onCompleteParams:[stripes2.b9]}),
    							new TweenLite(stripes2.b10, transtime, {alpha:randomRange(.1,1), onComplete:onFinishTween, onCompleteParams:[stripes2.b10]}),
    							new TweenLite(stripes2.b11, transtime, {alpha:randomRange(.1,1), onComplete:onFinishTween, onCompleteParams:[stripes2.b11]}),
    							new TweenLite(stripes2.b12, transtime, {alpha:randomRange(.1,1), onComplete:onFinishTween, onCompleteParams:[stripes2.b12]})
    							], 1, TweenAlign.START, .1 );
    }
    
    setInterval(init,1000);
    
    function onFinishTween(param1:MovieClip):void {
       //trace("The tween has finished! param1 = " + param1 + ", and param2 = " + param2);
    new TweenLite(param1, transtime, {alpha:randomRange(.7,1)})
    }
    
    
    //generate random num between a min and max value
    function randomRange(min:Number, max:Number):Number {
    return min + (Math.random() * (max - min));
    }
    
    
    

×
×
  • Create New...