A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Desperate for help!

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    1

    Desperate for help!

    I am very new to AS3 and Flash in general. I found a preloader on iStock that I want to use on a microsite I'm creating, but it's in AS2. I need to convert the following code to AS3 and I keep getting errors left and right. Can someone please convert it for me? Thanks in advance for your help!

    line._xscale = 0;
    var demovar:Number = 0;
    _root.onEnterFrame = function() {
    if (!_root.DEMO) {
    total = _root.getBytesTotal();
    loaded = _root.getBytesLoaded();
    percentage = Math.round((loaded*100)/total);

    line._xscale -= (line._xscale-(percentage+1))/4;
    if((line._xscale*300/100-36)>0){
    txt._x =line._xscale*300/100-36;
    }

    txt.text = percentage+"%";
    if (percentage>99) {
    _root.play();
    delete onEnterFrame;
    }
    } else {
    if (demovar<100) {
    line._xscale -= (line._xscale-(demovar+1))/4;
    txt.text = int(demovar += .3)+"%";
    if((line._xscale*300/100-36)>0){
    txt._x =line._xscale*300/100-36;
    }
    }
    if (demovar>100) {
    _root.play();
    delete onEnterFrame;
    }
    }
    };
    stop();

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    AS2 and AS3 are pretty far apart when it comes to the way preloaders are structured...take a look at gotoAndLearn's tutorial - it's probably easiest to go with that and just copy over the animation and objects from the istock file.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center