Be a Supporter!

subtraction problems

  • 266 Views
  • 7 Replies
New Topic Respond to this Topic
InterestingWalrus
InterestingWalrus
  • Member since: Jul. 29, 2009
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
subtraction problems 2009-12-13 10:02:26 Reply

here is my code:

function onProgress (e:ProgressEvent):void
{
var loaded:Number = e.target.bytesLoaded;
var total:Number = e.target.bytesTotal;
var pct:Number = loaded/total;
loader_mc.scaleY = 100 - pct;
loaded_txt.text = "Loading..." + (Math.round(pct * 100)) + "%";
}

loader_mc is a black box over an image over a black background, so when I say scale.Y = 100 - pct, I want it to scale down to reveal the image gradually according to how much has been loaded. Is there anything wrong with my subtraction, or is there a subtraction command I dont know?

Deathcon7
Deathcon7
  • Member since: Oct. 1, 2003
  • Offline.
Forum Stats
Member
Level 21
Writer
Response to subtraction problems 2009-12-13 10:04:32 Reply

Just set the the objects width to that of the percentage loaded. Otherwise, the object is going to be shrinking rather than getting larger.

BeamShank
BeamShank
  • Member since: Sep. 4, 2009
  • Offline.
Forum Stats
Member
Level 13
Art Lover
Response to subtraction problems 2009-12-13 10:06:26 Reply

Hello sir, we appear to be brothers.

InterestingWalrus
InterestingWalrus
  • Member since: Jul. 29, 2009
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to subtraction problems 2009-12-13 10:09:27 Reply

At 12/13/09 10:04 AM, Deathcon7 wrote: Just set the the objects width to that of the percentage loaded. Otherwise, the object is going to be shrinking rather than getting larger.

the point being, I want the object to be shrinking, so that once it shrinks to 0, the image behind it will show. I just cant get it to shrink.

InterestingWalrus
InterestingWalrus
  • Member since: Jul. 29, 2009
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to subtraction problems 2009-12-13 10:10:55 Reply

At 12/13/09 10:06 AM, RadWalrus wrote: Hello sir, we appear to be brothers.

Indeed.

Deathcon7
Deathcon7
  • Member since: Oct. 1, 2003
  • Offline.
Forum Stats
Member
Level 21
Writer
Response to subtraction problems 2009-12-13 10:24:25 Reply

It then becomes a matter of scope. Make sure you're accessing the clip appropriately.

InterestingWalrus
InterestingWalrus
  • Member since: Jul. 29, 2009
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to subtraction problems 2009-12-13 10:34:50 Reply

At 12/13/09 10:24 AM, Deathcon7 wrote: It then becomes a matter of scope. Make sure you're accessing the clip appropriately.

I know I am, when I set it to go by the percent loaded it goes accordingly. I think there's a problem with the way I want to subtract...

InterestingWalrus
InterestingWalrus
  • Member since: Jul. 29, 2009
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to subtraction problems 2009-12-13 10:39:20 Reply

wait I got it. It was a really dumb mistake. I just had to replace 100 with 1, because the loaded/total is less than one. REALLY stupid of me.