ActionScript 3.0 :: X Value Changing When Width Changed

Aug 3, 2011

I'm working with a rectangle I used code to generate

hpBar.graphics.beginFill(0xFF0000);
hpBar.graphics.drawRect(40, 40, 90, 22);
hpBar.graphics.endFill();
addChild(hpBar);

The rectangle itself works fine without any problems, but when I try to change the width of the rectangle, it's x value decreases slightly, but I'm not sure why it does this. (90 is the original width, hpPerc is another value that will for my uses always be between 0 and 1).
hpBar.width = 90* hpPerc;
Unfortunately, as I stated, changing this shape's width seems to change the x value as well, which really doesn't work at all.

View 8 Replies


Similar Posts:


ActionScript 3.0 :: Flash MouseX When Width Changed

Aug 1, 2011

Not sure if I'm missing sth or is it just a bug. I have a movieclip on stage, it's a simple rectangle drawn with a rect tool (no stroke) I add an event listener to trace out the mouseX, works OK so far. When I increase its width the mouseX traces wrong values. Here's a sample code:

[Code]...

View 3 Replies

Actionscript 3 :: MovieClip Resizes But Its Children's Height And Width Are Not Changed?

Feb 27, 2011

Changing the width and height of the parent MovieClip does not bring change in the width and height of the inner MovieClip. The parent MovieClip is placed at Stage and is resized manually. When I assign the dimension of the parent MovieClip to the inner MovieClip through code, the parent MovieClip dimension is changed. I want both MovieClip to be of same width and height at runtime. However, parent MovieClip dimension is changed at design time by me.

Example:There are two MovieClip, one inside another. Now parent MovieClip is placed at Stage at design time and its dimension is (50,50) and the child MovieClip which is inside the parent MovieClip has also same dimensions (50,50). Now, I manually change the parent MovieClip dimension by pressing Q and stretching it with mouse, the dimension of the parent MovieClip is now (100,150) or whatever I like. Now double-click on parent MovieClip and check that inner MovieClip dimension remains same i.e. (50,50)Now in AS3 code, I change the width and height of inner MovieClip like this:

saveheight = parentmc.height;
savewidth = parentmc.width;

now I change the child MovieClip according to the dimensions of the parent MovieClip like this:

parentmc.inner_mc.width = parentmc.width;
parentmc.inner_mc.height = parentmc.height;

but this brings change in parentmc also so I reassign value to parentmc like this:

parentmc.height = saveheight;
parentmc.width = savewidth;

In above case, parentmc and inne_rmc dimension should be same i.e (100 ,150). With swapping the values as above, I get parentmc and inner_mc to be of same dimension, but object size is never (100, 150), I have checked it with pixel-perfect air app.

View 3 Replies

ActionScript 3.0 :: Changing Scene When ComboBox Changed?

Jan 14, 2010

I'm a complete newbie to Flash and programming, so please forgive my lack of knowledge! I have been trying for a good couple of hours now to do what I'd think would be a simple task - change scene when the value in a comboBox is changed.This is the code I have:

stop();
dropdown.addEventListener(Event.CHANGE, changemade);
function changemade(event:Event):void {

[code].....

View 3 Replies

Flex :: Air - Background Not Changed After Changing Theme?

Jun 27, 2010

I am developing an AIR application and I want to change my project theme to one of the additional included themes that is packaged with Flash Builder 4. So, I went to the Project Theme and changed it and it looks like it is supposed to in the Design View. When I run the application, the components (eg: a button) themselves look like it is supposed to, but the application's background is just white instead of the displayed color in the design view.

View 2 Replies

AS3 :: IDE - Changing .swf Width And Height

Dec 13, 2009

Is there any possibility to change screen width and height not in Flash ( in Properties ), but in Code [ any AS3 line? ].

View 1 Replies

List Component: Changing Column Width?

May 27, 2011

How is it possible to change the width and height of the cells in a List Component in AS3? I've tried experimenting with the cells and different methods but none seem to work.For example, let's say I want to make each list button cell very narrow.

View 1 Replies

ActionScript 3.0 :: Mysteriously Changing Width Of Items?

Oct 4, 2009

I am working on this website and I decided to add some flash to the front page in the form  of a little image gallery with a nifty slide effect. The problem is this. For some reason its squishing my  images. When you look in the scripting you will see that I've set the image  width to the full width of the stage, but when you test the movie they are  getting squished to about 3/4th's the width of the stage (ive double checked the image size as well).

View 5 Replies

ActionScript 3.0 :: Resize A Line Without Changing Width?

Jan 15, 2010

I have created a line (on the stage) where the height is 10px and the width is 2px. To resize it, I have converted it into a symbol (MovieClip) and given it an instance (let's say li ).

However, when I enter...li.height = 200; or resize the MovieClip with the mouse, the line is 200px tall, but it has also grown considerably thicker! However, if I go into the MovieClip, click on the Drawing and resize it there, I the line stays nice and thin.

View 4 Replies

ActionScript 2.0 :: Dynamically Changing Height And Width

Aug 11, 2005

I want to change the height and width of an object (specifically doubling it) after an interval of 2 seconds until the height and width of the object reach over 100. I've made two different scripts to try to make this possible.

[Code]...

View 4 Replies

ActionScript 3.0 :: Changing The Height Of A 1px Line Changes The Width Too?

Apr 13, 2009

I have a movieclip that has a 1px wide line by 10px high. Im trying to resize that line with tweenlite, however when i change the height it makes it wider too... How can i do this and keep the line 1px?

View 2 Replies

ActionScript 3.0 :: Keep Stroke Weight While Changing Width?

Mar 16, 2010

I have a movieclip 'cursor' with in it two rectangles. One of them is dark and one is light, so the cursor is blinking. Now, when I want to change the width of this cursor to 150 (where it was 30 before), I do:

Code:
cursor.width = 150;

This not only changes the width of this movieclip, but also the weigth of the (whole) stroke of the two recangles. How can I prevent this strokechange from happening?

View 1 Replies

ActionScript 3.0 :: Changing Width Of Sprite Seems To Change Height Too?

Feb 5, 2009

Here is some code I have.

[code]
_buttonUnderline = new Sprite();
with(_buttonUnderline.graphics) {
[/code].....

When the Tween takes place though it not only changes the width, it changes the height as if it were scaling it up in both directions. Why does this behavior take place? And how can I get it so that only the width changes? I have also tried using scaleX as the property but it does the same thing.

View 1 Replies

ActionScript 1/2 :: Dynamically Changing The Height And Width Of Stage?

Jun 3, 2009

how can I change the height and width of stage dynamically. I tried it with the following code:
 
Stage.height = 250;
Stage.width = 250;
 
during the run time. Initially the Stage is at a height and width of 370 and 450 respectively. Also when I tried to trace the height and width of Stage after resizing the stage width and height, its showing the old value of width and height. That means the width and height not chnaging.

View 5 Replies

ActionScript 3.0 :: Programmatically Changing Symbol Width And Height

Oct 11, 2009

I am trying to change the width and height of instances of a symbol programmatically. Basically, the symbol contains a few colored rectangles, a bitmap, and some text. I want to change the height and width of each instance of the symbol based on how low the text string is that is in the instance's text field, but the bitmap's size should always stay the same, 24x24 pixels.[code]The problem is that using this code seems to scale everything up, including the bitmap. I have tried to programmatically add the 24x24 pixel bitmap to the symbol programmatically after I changed the height, but it still seems to be scaled..

View 1 Replies

Flex :: Changing Width / Height Can't Affect Contents

Jul 13, 2010

I thought I had a handle on AS3, DisplayObjectContainers, etc. but this basic thing is really confusing me: changing the width/height of a sprite does not affect it's visual contents - either graphics drawn within it or any children it may have.[code]...

View 2 Replies

ActionScript 3.0 :: Changing Width Of Sprite Also Seems To Change It's Height?

Feb 5, 2009

[code]When the Tween takes place though it not only changes the width, it changes the height as if it were scaling it up in both directions. Why does this behavior take place? And how can I get it so that only the width changes? I have also tried using scaleX as the property but it does the same thing.

View 1 Replies

ActionScript 3.0 :: MovieClip With Outline - Changing Width / Height

Aug 29, 2009

I develop some components where I use movie clips as skin. In the scene I have 2 movie clips with width 200px and height 100px, one of them I change the width to 200px and height to 100px, well, it should remain the size as nothing happens but it doesn't. The movie clip that I change the size through as3 it's actually getting smaller, and more strange, it only happens when the movie clip has an Outline. The file is attached. It's Flash CS4.

View 2 Replies

ActionScript 2.0 :: Drag CheckBox To Stage And Changing Width?

Oct 27, 2010

I can drag a checkbox to the stage and change the width in the property inspector and it works fine. If I target the width when attaching it dynamically, the whole box and label get skewed.

View 0 Replies

ActionScript 2.0 :: Changing The Width Of A Picture By Sliding A Button?

Feb 5, 2006

How can I create a button to control the width of a certain picture by just sliding the button on a scale in Flash 8? (I've found the actionscript for the button in a sample file in Flash MX. It looks like this:

onClipEvent (load) {
initx = _x;
left = _x-50;

[code].....

View 4 Replies

ActionScript 2.0 :: Changing Movie Clip Symbol Width?

Aug 13, 2010

I searched the forums, but couldn't really find anything that matched my specific needs. I have a movie clip symbol that is your character, I also have a movie clip symbol that is named fuel and it represents the fuel you have left. I tried this in your character:

if (Key.isDown(Key.UP)) {
yspeed -= ypower;
fuel._width -= 50;
}

as a little bit of code. fuel._width -= 50; is what I'm really interested in. yspeed-= ypower; is just my movement, which works. So why doesn't my fuel width change?

View 6 Replies

ActionScript 3.0 :: Have A Movieclip (hairline Stroke) And After Changing Its Width Or Height It Disappears?

Jan 4, 2010

i have a movieclip (hairline stroke) and after changing its width or height it disappears...

View 1 Replies

ActionScript 3.0 :: Draws A Couple Of Lines With Changing Alpha And Width Whenever The Mouse Is Moved?

Apr 23, 2009

I have wrtitten some code that draws a couple of lines with changing alpha and width whenever the mouse is moved. I need to convert this code to AS3 so that I can use it in conjunction with some video tracking.

Code:

var speed:Number = 100;
var myNumber:Number;
var myMax:Number = 50;[code]...

View 1 Replies

ActionScript 3.0 :: Flash CS5 - MovieClip Disappears When Dynamically Changing Width/height Property

Feb 21, 2012

a movie clip symbol is designed and subclassed in Flash, but get instanced and addChild-ed in AS3. It works well as long as I don't change it's width/height property (scaling works too), but if i do, it disappears

View 2 Replies

Flex :: Changing ScaleX/scaleY On Parent Scales The Children But Doesn't Update Height/width Property?

Nov 23, 2010

I have created a custom component - MyImage - that has two children including a Bitmap as well as a Sprite.My display object hierarchy is as follows -

mx:Canvas
view:MyImage
mx:Bitmap

[code].....

View 1 Replies

Actionscript 3 :: Canvas Total Width (visible Width + Hidden Scrollable Part)?

Apr 19, 2010

It's probably a no brainer, but I've spent the last 40 minutes or so looking for it to no avial.

I have a Canvas control with a fixed width and a horizontal scrollbar.I'm trying to find the actual width of the control.The .width (fixed width) + the part being revealed by the scrollbar.I tried explicitWidth, width + maxHorizontalScrollPosition, and some other combos but non of them hit the spot.

View 1 Replies

Professional :: SimpleButton.width Doesn't Change - Width And Height Remain 0

Jun 1, 2010

I am looking at the SimpleButton entirely wrong. Here's what I'm doing (inside of a MovieClip):

[Code]...

the close_btn.width and height remain 0. Am I supposed to just rely on the DisplayObject members of the SimpleButton completely and ignore width/height/x/y or what?

View 2 Replies

Actionscript 2.0 :: Stage.width - Make A Minimum Width And Stop Resize?

May 27, 2009

is there a way to make a minimum width and stop resize? I have a menu I am building that is locked to the bottom of the browser and 3 buttons on the left and a movieClip on the right. When you resize the browser window - currently - you can make the button on the right sink under the three on the left.

[Code]..

View 6 Replies

Actionscript 3 :: Finding The Width Of TileList - Scrollbar Width Flex

Feb 3, 2010

I've got a TileList with verticalScrollPolicy="on".

Is there a property that returns the width of the tileList minus the width of the scrollbar?

View 1 Replies

ActionScript 3.0 :: Resizing Movieclip Width To Stage Width Dynamically?

Jul 13, 2011

how to get a movieclip named "topnav" to resize it's width to match that of the stage. I am trying to resize the width of a top nav bar across a resizable RIA. I have started with the following code but with only partial success:

Code:
stage.addEventListener(Event.RESIZE, resizeListener);
function resizeListener (e:Event):void {
var reg2 = stage.stageWidth / 100;

[Code].....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved