Processing
 

what is difference between _height & height for movie clip in as2 flash

19/05/2012 10:30#1

Joined at: 6 months ago

Post: 1

Thank: 0

Thanked: 0

I am doing zoom in and out for Movie clip. I get the original height by mc.height. After scale the movieclip, i need the increased height of movie clip. So i have used the mc._height property. But it gives more higher values it is not original value. But also it changes on roll over within the value less and more value.

Pls Help me.

Thanks.

Hi, I am doing zooming concepts. On zooming movieclip width is working correctly. But in case of tweening image the width & height is increasing abnormally. What is reason i did not find that. Pls help me.

this.onMouseMove = function() { constrainedMove(bg_mc, 4, 1); };  function constrainedMove(target:MovieClip, speed:Number, dir:Number) { var mousePercent:Number = _xmouse/Stage.width; var mSpeed:Number; if (dir == 1) {     mSpeed = 1-mousePercent; } else {     mSpeed = mousePercent; } target.destX = Math.round(-((target._width-Stage.width)*mSpeed));       target.onEnterFrame = function() {     if (target._x == target.destX) {         delete target.onEnterFrame;     }                else if (target._x>target.destX) {         target._x -= Math.ceil((target._x-target.destX)*(speed/100));     }                else if (target._x<target.destX) {         target._x += Math.ceil((target.destX-target._x)*(speed/100));     } }; } 
19/05/2012 15:53Top#2

Neil

Member

Joined at: 10 months ago

Post: 177

Thank: 0

Thanked: 0

There is no .height property in Actionscript 2, as you pointed out its ._height, its more than likely that you have code for Actionscript 3.

As a side note all older variables in AS3 were _visible, _width, _height etc. These were changed to visible, width, height etc.

Hope this helps.

EDIT:

If you use _xscale or _yscale then you may not get the width and height you expect. Here is an example using a Matrix. First create a box on the stage and give instance name of box make it 100x100 in size:

import flash.geom.Matrix;  // will trace 100 trace(box._width);  // will trace 100 trace(box._height);  // get the current matrix and scale it by factor of two - doubling it var matrix = box.transform.matrix; matrix.scale(2,2);  // apply the matrix back to the movieclip box.transform.matrix = matrix;  // will trace 200 trace(box._width);  // will trace 200 trace(box._height); 

There is a good article on using - Matrix in actionscript 2 by senoculor

I really hope this helps you, if it does then please mark the answer as correct.

20/05/2016 17:56Top#3

dreko90

Member

Joined at: 6 months ago

Post: 1

Thank: 0

Thanked: 0

I just wanted to update on this article with some useful information. Both versions of height will highlight as blue because they both do exist as keywords. Most objects use the ._height property but the Stage class uses .height. It's slightly confusing but a perfect example of the inconsistencies with AS2.

Stage.height MovieClip._height 
Similar articles

Open a folder in finder/explorer from a webpage?

5 years ago - Reply: 2 - Views: 80

How do I escape a reserved word in Actionscript?

5 years ago - Reply: 2 - Views: 198

Save PPS/PPT files as SWF using C#

5 years ago - Reply: 2 - Views: 171

Ways of making a graphic/visual novel in flash

6 years ago - Reply: 3 - Views: 114

Use PhoneGap + HTML5 and an Embedded Flash Movie

5 years ago - Reply: 2 - Views: 96

View word docs and PDF in browser?

5 years ago - Reply: 2 - Views: 52

ActionScript 3 Read JPEG quality

7 years ago - Reply: 2 - Views: 59

Export/Test Movie Issues

5 years ago - Reply: 3 - Views: 39

Flash always on top in Android browser workaround?

5 years ago - Reply: 2 - Views: 149

Sending Json Form from Flash AS3

5 years ago - Reply: 2 - Views: 29

parsing a swf/fla (using php?)

6 years ago - Reply: 2 - Views: 44

Getting high FPS on Flash/AIR games for mobile?

4 years ago - Reply: 2 - Views: 58

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re