Jump to content
Search Community

pizza0502

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by pizza0502

  1. Hi, I'm trying to use scrollTo in React. But I can't make the increment value to works with scrollTo...

     

    Here is the function that not working:

    handleClick = () => {
            let incrementNumber = 500
            TweenMax.to('content', 0.5, { scrollTo: { x:'+='+incrementNumber } }); 
        }

     

    Here is the function that can works if I just use a fixed number, but like this I can make the scrollTo increase 500px every time I click it:

    handleClick = () => {
            TweenMax.to('content', 0.5, { scrollTo: { x:500} }); 
        }
  2. Hi,

     

    I've work around with loadermax that I've learn it this few days.

    I found a preloader file at here and i try to reuse it.

    but the preloader is not working, here is my code:

     

    stop();
    
    import com.greensock.*;
    import com.greensock.loading.*;
    import com.greensock.loading.display.*;
    import com.greensock.events.LoaderEvent;
    import com.greensock.loading.LoaderMax;
    import com.greensock.loading.SWFLoader;
    import flash.display.MovieClip;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    
    var _tf:TextField;
    var _tfFormat:TextFormat;
    var _loadingBar:LoadingBar;
    function Loader2()
    {
    init();
    }
    
    function init():void
    {
    _tfFormat = new TextFormat  ;
    _tfFormat.font = "Arial";
    _tfFormat.size = 15;
    _tfFormat.color = 0x000000;
    _tfFormat.bold = true;
    _tf = new TextField  ;
    _tf.autoSize = TextFieldAutoSize.CENTER;
    _tf.text = "Loading Interface...";
    _tf.setTextFormat(_tfFormat);
    addChild(_tf);
    _tf.x = (stage.stageWidth / 2) - (_tf.width / 2);
    _tf.y = (stage.stageHeight / 2) - (_tf.height / 2)
    ;
    _loadingBar = new LoadingBar  ;
    addChild(_loadingBar);
    _loadingBar.x = (stage.stageWidth / 2) - (_loadingBar.width / 2);
    _loadingBar.y = (stage.stageHeight / 2) - (_loadingBar.height / 2) + 20;
    var queue:LoaderMax = new LoaderMax({name:"mainQueue",onProgress:progressHandler,onComplete:completeHandler,onError:errorHandler});
    
    //append several loaders;
    queue.append( new SWFLoader("main.swf", {name:"contentClip", estimatedBytes:930000, container:this, visible:true, autoPlay:true}) );
    
    //start loading;
    queue.load();
    }
    
    function progressHandler(event:LoaderEvent):void
    {
    _loadingBar.loadingPerc.scaleX = Number(event.target.progress);
    trace("progress: " + event.target.progress);
    }
    
    function completeHandler(event:LoaderEvent):void
    {
    addChild(LoaderMax.getContent("main"));
    _tf.text = "SWF LOADED";
    _tf.setTextFormat(_tfFormat);
    trace(event.target + " is complete!");
    }
    
    function errorHandler(event:LoaderEvent):void
    {
    trace("error occured with " + event.target + ": " + event.text);
    }

     

    btw, the main.swf i loading is containing 2 more swf loaded from external. is it i need to put the code requireWithRoot at here or the main.swf or the subpage.swf?

×
×
  • Create New...