Jump to content
Search Community

pixelbeat

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by pixelbeat

  1. Thanks for replying. The callbacks were working, but IDK if coffeescript needed the function to be declare that way.

    With your reply I successfully fixed the problem and found that I can 'debug' the callbacks by using:

     

    init = new TimelineMax({repeat: -1, yoyo: true, onUpdate:print, onUpdateParams:["Animation running"]})

     

    Declaring the updateSlider function before the reference FIXED the problem.

     

    # Working version
    
    slider.on "change:value", (event, ui) ->
    	init.progress(ui.value)
    	dragMe.x = slider.knob.x + 16
    	return
        
    # Declare the function BEFORE the timeline.
        
    updateSlider = () ->
    	slider.value = init.progress()
    
    init = new TimelineMax({repeat: -1, yoyo: true, onUpdate:updateSlider})
    
    # This works as well
    
    init.eventCallback("onUpdate", updateSlider)

     

    Thanks!

    Screen Shot 2017-07-21 at 4.00.15 PM.png

  2. I successfully implemented a native slider from Framer to control the timeline, instead of using jQuery and the jQuery UI slider library.

     

    My main problem emerged when I realized that the timeline events [onComplete, onProgress...] were not trigger at all. 

     

    Here is the prototype.

     

    Sadly, I don't know how to isolate the bug or recreate this outside of Framer, but essentially my code goes as follows.

     

    init = new TimelineMax({onComplete:updateSlider})
    # hSection is an Framer layer
    init.from(hSection, .5, {opacity: 0, y:"+=200", ease:Power3.easeInOut}, 0)
    # footer.children is an Framer layer with elements within
    init.staggerFrom(footer.children, .5, {opacity: 0, y:"+=25", ease:Power3.easeInOut}, -.15)
    
    # Here is the slider component
    slider = new SliderComponent
    	width: Screen.width / 2
    	height: 20
    
    # Here is the slider event that I used to drag and affect the timeline progress. This works like a charm.
    slider.on "change:value", (event, ui)->
    	init.progress(ui.value ).pause()
    	return
    
    # Here is the function that needs to be triggered the moment that timeline is completed. Nothing happens.
    updateSlider = () ->
    	print init.progress()

     

     

    Can you help me out?

      

    CoffeeScript code

    See the Pen by kyIiK (@kyIiK) on CodePen

  3. Fixed & working!

     

    function closeAndPlay(setFrame:Number):void {
      var closePictures:TimelineMax=new TimelineMax({paused:true,  onComplete:gotoAndStop, onCompleteParams:[setFrame]});
      closePictures.insertMultiple( TweenMax.allTo(pictures, 2.5, {alpha:0, ease:Quart.easeInOut}, 0), 0.5);
      closePictures.play();
      }

  4. I got this menu, that triggers a function called closeAndPlay(), basically closes an array of pictures and then calls the function gotoAndStop, but it's not working.

     

    
    function hitButton (e:Event){
    closeAndPlay(5);
    }
    
    function closeAndPlay(setFrame:Number):void {
    trace(setFrame)
    var closePictures:TimelineMax=new TimelineMax({paused:true});
    closePictures.insertMultiple( TweenMax.allTo(pictures, 2.5, {alpha:0, ease:Quart.easeInOut}, 0), 0.5);
    closePictures.addCallback(gotoAndStop, setFrame);
    closePictures.play();
    }
    
    

     

    What I am doing wrong?

     

    Cheers to everyone and thanks for your help.

    D.

  5. There is anyway to play/resume a TimeLineMax from an external swf?

     

    I tried this, but Flash doesn't recognize mainTimeline as an object:

     

    contentContainer.mainTimeline.play();

     

    //and it returns this

     

    TypeError: Error #1010: A term is undefined and has no properties.
    at main_fla::MainTimeline/setContent()

  6. Hello guys.

     

    I've been lurking this forum for months and it's been really helpful.

     

    A couple of weeks ago I discover LoadMax and it's fantastic, but I can't make it work in a very basic situation.

     

    What would be the best approach to this problem?

     

    Let's say I have a classic menu (4 items), that triggers 4 different swf files to preload on a main scene, on the same container.

     

    I tried this, but obviously I have no idea how to use this in a proper way.

     

    
    var loader1:SWFLoader = new SWFLoader("content1.swf", {onComplete:onLoadSWF});
    loader1.load();	
    var loader2:SWFLoader = new SWFLoader("content2.swf", {onComplete:onLoadSWF}
    
    var loadContentMC:MovieClip;
    
    function onLoadSWF(event:LoaderEvent):void {
       loadContentMC = event.target.rawContent;
       TweenMax.fromTo(loadContentMC, 3, {alpha:0, x:stage.stageWidth/2-355, y:285}, {alpha:1, x:stage.stageWidth/2-355, y:285});
    
    }
    
    hit_item_1_btn.addEventListener(MouseEvent.CLICK, clickHandler1);
    
    function clickHandler1(event:MouseEvent):void {
    
    /*
    I don't know how to tell Flash if the content of the object 'loader2' was loaded, and in that case, unload it and load the proper file.
    */
    loader2.unload();
    
    }
    

     

    I will appreciated if anyone can bring any light to this matter.

     

    Thank you all!

    D.

×
×
  • Create New...