ActionScript 3.0 :: Movieclip.width Is Not Consistent ?

Nov 1, 2011

I am creating a minesweeper copy, and i've bumbed into a problem, which I and a fellow programmer finds quite strange.

My code is set up like this: Initializer.as (Just a temp. initializer.(duh)). This creates a new gameGrid, and passes x and y number of blocks, as well as the size.

GameGrid.as (movieclip) This is the board. This controls the whole game, which are filled with:

Block.as (movieclip) Represents a block. Has a size parameter in its contructor, which are the exact same size as the one in GamGrids contructor. For non-mines, a textfield is added as a child. When a flag is set, the block adds a child:

Flag.as (movieclip) Same size in its contstructor.

In the library (in Flash CS5), every movieclip has the same width (60px).

Now, the problem is that the text, bombs and flags are only in the same size as the blocks when i set the size to '57'. If it's lower than 57, the bombs etc. are even lower. At ~30, they're half the size. At 130, its almost the double.

Here's the classes (with some comments):
Initializer

Code:
package {
import flash.display.DisplayObjectContainer;
public class Initializer {
private var stg:DisplayObjectContainer;

[Code].....

View 4 Replies


Similar Posts:


Flash :: Movieclip.width Returns Higher Value Than Movieclip Stage On Width?

Mar 8, 2010

I have a Movieclip on stage with nested movieclips inside. All referenced at 0,0. None of the child movieclips load any dynamic content, animate or have Masked Layers. It does have an input textfield in one of the child MCs. The parent MC shows 280 px width, while it returns 313 px with a .width trace. There is no code that alters the .width value of the parent MC at run-time. And the ParentMC on stage is not scaled (it is at 100% width/height)

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

Flex :: Generating A Consistent ID For A Given Computer In Air?

Mar 3, 2010

In C++ I Can Read The MAC Address Of The NIC and Use It To Generate A Unique Identifier For Each Computer That Interacts With My Web Service. Even If The User Deletes Their Cookies, And Temporary Internet Files, Reformats Their HardDrive And Installs A Different Version Of Windows, That Computer Still Generates The Same Unique ID.How Can I Create Such A Unique Key Using Flex Or Air? The Number Has To Be Either Hardware Based Or Similarly Tamper Resistant.

View 1 Replies

Actionscript 3 :: Creating A Consistent 'random' Value?

Sep 14, 2011

creating consistent random values in actionscript. I assume this would, be by using a consistent seed value

View 1 Replies

ActionScript 2.0 :: Consistent Loading To Flash?

Mar 3, 2008

This may be a weird question to ask. Below I have a simple php/mysql query which pulls some simple data.I've figured out how to display it all in Flash. f someone updates the database, adding a few new rows in the table, can Flash refresh on it's own so the new records show in the flash movie?

[Code].....

Or does flash have more than one way to reload all the data again?

View 1 Replies

ActionScript 3.0 :: Object Not Consistent After Construction?

Aug 30, 2011

I'm building a class that reads data from an xml file. The constructor takes the xml path and opens the file. It adds an event listener for the loading completion. But if constructor looks like

Code:
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.load(new URLRequest("..."));

it will (probably) end-up when xml is not loaded yet. Are there any ways to stop the constructor execution until the xmlLoaded function has finished?

View 4 Replies

ActionScript 3.0 :: Get The Width Or Height Of The Parent Movieclip It Always Showing The Values Of The Small Nested Movieclip

Jun 1, 2010

i am using a movieclip who has two nested movieclips, the problem i am dealing is that when i try to get the width or height of the parent movieclip it always showing the values of the small nested movieclip, when i draw the movieclip it draw perfect but when i read this values shows that error, what can i do?

View 2 Replies

ActionScript 3.0 :: Getting Flash Movie To Playback At A Consistent?

Nov 16, 2009

Im having trouble getting my flash movie to playback at a consistent/good rate in Internet Explorer. Its not terrible out of IE but it looks much better out of Firefox and Safari. Im publishing my swf at Auto Low out of Flash and setting the swf to Auto Low on my html page out of Dreamweaver, my .flv is about 8 Megs, runs 1:25 with a kbps of 700 and the audio is set to 128. Is there something glaringly wrong with my settings, something I can trim in order to get it to playback correctly in IE? Someone suggested upping my buffer time but I can't seem to locate the panel in Flash CS4, anyone know where this tab lives?

View 0 Replies

ActionScript 3.0 :: Scrubber Bar - Consistent Volume And Clickable Playlist

Jul 22, 2009

How to get my audio scrubber to work, make the volume consistent whether you stop the song and restart or move to the previous of next song. Also, I just finally figured out how to add columns to my XML playlist by using a Datagrid but I do not know how to hook the playlist up to the XML in order to call the particular song that is clicked on.

I started this project working as a tutorial, but the tutorial only gave the basic XML audio jukebox set up, since then, I've been scouring forums, google, tutorials on youtube, etc. But I find that the code is so "method" specific, meaning that everything hinges on your particular way you decide to get to the end result.

1)Volume slider works, but the volume keeps reverting back to the default volume everytime the song is stopped and re-started or a new song is advanced to with the Previous or Next button - The volume needs to stay consistent at whatever volume level that the slider is left on.

2)PlayList needs to be functional. Right now, you can advance through the play list by using the jukebox previous and next buttons, but the playlist should have the ability to highlight whatever song is playing from the list as well as play songs independently when any song in the list is clicked. (I was able to do this successfully with the tutorial version which used a list component, but the only problem with that is that List components only allow 1 column - so I had to change to a datagrid to allot for my 3 columns)

3)Scrubber - I would like the scrubber to do what a scrubber does for each song when the song is being played.

The files can be found here [URL].

View 2 Replies

ActionScript 3.0 :: Consistent Value From Top Margin / Padding Of TextField To Top Of Actual Text

Jan 11, 2011

How can I get a consistent value from the top margin/padding of a TextField to the top of the actual text.According to the docs (link below), the text field has a 2px gutter on all sides. But there seems to be another gutter that seems to increase / decrease with the size of the text.Using times new roman for a default font size, I can get the baseline of some random text using what we know: I know that there is a 2px gutter all the way around the text field and we can get the ascent through textfield.getLineMetrics(0).ascent. If I draw a line at that position I'll get a line about 2 px below the actual text. Works fine.Now if I want to draw another line at the TOP of the text it's a guessing game. At 36pt text it's 8px from the top of the textfield. At 72pt text it's more like 12px from the top, and at 144pt text it's more like 20px from the top.URL...

View 0 Replies

ActionScript 3.0 :: Keeping Consistent Spawn Rate Using Timer Class

Jan 10, 2012

Basically what I'm trying to do is keep the enemies spawning at the same rate. I get it to work kind of but when I toggle the speed there is a gap between spawns. I figure this is because the timer resets to the new delay. I'm working on a tower defense game and I'm trying to get the fast forward button to work.

Code:
import flash.display.*;
import flash.events.*;
import flash.utils.*;
var enemyTimer:Timer;
var enemySpawnRate:Number = 800;
[Code] .....

View 10 Replies

Actionscript 3 :: Create A Flash Program With Consistent Performance Across Multiple Machines?

Jun 17, 2011

I want to create a flash program that tracks mouse and keyboard biometrics such as mouse movement speed, click rate, length of keystrokes and so forth. How can I ensure that if a user duplicates his/her actions across multiple machines with varying processor speeds I will record the same data?

View 2 Replies

ActionScript 3.0 :: DrawRoundRect - Corners Of A Rectangle Are Not Very Consistent When The Curve/ellipse Values Are Very Low?

Jun 1, 2009

The corners of a rectangle drawn with drawRoundRect are not very consistent when the curve/ellipse values are very low (2-5px or so), most visibly when there's a border added.Even with hinting turned on, there's still a pretty ugly difference. When set to 3px (horizontal and vertical), the right-side corners look pretty close at around 3px, but the left-side corners are very off, and both look to be maybe 1px curved.

View 1 Replies

ActionScript 3.0 :: MovieClip Width Is Always Zero

Mar 10, 2011

I am having some trouble with some Movieclip, whenever I try detecting the MC's width, it always display zero for some reason. On the 2nd frame, the following function will start loading. After the initial turn, I have another condition statement to check whether it should go to another frame or not. If it's staying in this frame, it will load this function again, and the temp_counter will increases.

tel_phrase_holder is just a dynamic textfield I use to display the width only.
function tel_load () {
tel_holder.removeChildAt(0);
var a = new Loader();
tel_holder.addChild(a);
a.load(new URLRequest(tel_pic_start[temp_counter - 1]));
tel_phrase_holder.text = tel_holder.width.toString();}

I tried putting "tel_phrase_holder.text = tel_holder.width.toString();" at the beginning as well like I did at the following code. It's slightly better, but it's loading the previous picture's width instead of the current picture's width.
[Code] .....

View 1 Replies

Set The Movieclip Width And Height With The Button?

Mar 18, 2010

i want to zoom the movie clip, for this i have set the movieclip width and height with the button. It is correct or anything els

View 2 Replies

ActionScript 3.0 :: Initialize Movieclip's Width Value Only Once?

Nov 30, 2011

setting a rectangle movieclip instance's width to 20 at the very start, before the ENTER_FRAME function is fired, but the width remains 20 throughout. I've tried different methods, here are two examples.Here's a simplified, short example:

Actionscript Code:
var rect_mcW:Number = rect_mc.width; //store original widthrect_mc.width = 20; //then set the rectangle's width to 20rect_mc.addEventListener(Event.ENTER_FRAME, growRect);function

[code]....

Ok, so the rect_mc's width remains 20 for each ENTER_FRAME event, even though the event listener function should grow it, but doesn't.One other way I tried was wrapping the 20 width inside a function:

Actionscript Code:
// opening statements omitted for brevity//first call to addEventListener:rect_mc.addEventListener(Event.ENTER_FRAME, init_width); //on first

[code]....

this second example yields the same result, the rect_mc width remains 20 even Though I thought the event listener that calls the function that sets it to 20 is removed first thing in the second event listener.

So, I assume it's because the code is read from top, and the code that sets width to 20 gets read and executed over and over. But still, shouldn't the growing part also take place over and over? What I want obviously is to store the original width, but start the animation with a width of 20, but just once.

View 7 Replies

ActionScript 3.0 :: Read The Width Of The Movieclip?

Jun 14, 2010

The task I'm gonna perform should be pretty simple: Inside an object I've created ,which extends MoviClip, I pickup a movieclip that stands on main timeline (root) with the getChildByName() method. Once I picked up the Movieclip I would like to read the width of the movieclip and here comes the problem. The movieclip is composed by two level: A mask level (169px width) and another level with an image of 331px width. When I  attempt to get the width of the movieclip it returns the unmasked movieclip width (331px) instead of the maksed size(169px). I also tried with the getBounds() method but it returns the same value.
 
The movieclip is masked within flash (not through actionscript). A possible solution would be giving a name to the mask inside the movieclip and then perform another getChildByName and read the size of the mask, but this wouldn't be a very clear solution (also because I will have to deploy this to another people not very familiary to flash , so they might forgot to properly name the mask and all this kind of program. The best solution would remain automatically detecte the masked width of the movieclip).
 
I would like to understand why flash consider the whole Movieclip content width disregard the applied mask.

View 1 Replies

Actionscript 3 :: Movieclip Width Changes Instead Of Height?

Apr 9, 2012

I'm working in Flash Builder 4.5 in pure Actionscript 3.0

I have a movieclip (swc) , I am doing the following :

_visualItem.bgMiddle.height = 200;

bgMiddle is an independant clip only has a single shape in it. On debugging the height remains the same (2.2) but the width changes to 5111. Haven't been able to track it down.

View 1 Replies

ActionScript 2.0 :: Adjusting The Width Of A Movieclip

Oct 13, 2003

I need to read two image locations from a file and join it together. For this i used the following code.

[Code]....

With this code I can load two images but I can't adjust the position of the second image with respect to first i.e: iam unable to capture the width of the first image.

View 2 Replies

ActionScript 2.0 :: Increase That Movieclip's Width To 40?

Apr 19, 2007

say I have a movie clip that's 20 by 20. then, with actionscript, i increase that movieclip's width to 40. is there a way to update the scale of the clip so that the movieclip's _xscale represents the new 40 by 20 rectangle rather than the original 20 by 20 box?

View 7 Replies

ActionScript 3.0 :: Movieclip Height And Width

Nov 11, 2010

I'm making a little photo album in flash, where my pictures are being added in a movie clip. The problem I have is when I add a with and height to my movie clip, I can't see it anymore. It's probably a stupid mistake, but I've been searching for an solution these past days, but I didn't find any.

(when I don't add the width and height, I can see the pictures) Here's a little part of the code.

Code:
var mc:MovieClip = new MovieClip();
mc.width=300;
mc.height=100;

[Code].....

View 2 Replies

ActionScript 2.0 :: Adjusting The Width Of A Movieclip?

Oct 13, 2003

I need to read two image locations from a file and join it together.For this i used the following code.

Part A:

//this reads from the file images.txt and puts in an array "images"
//the size of the array "images" is 2
//
m = new LoadVars();
m.onLoad = function(ok) {[code]...........

With this code I can load two images but I can't adjust the position of the second image with respect to first i.e: iam unable to capture the width of the first image.

View 2 Replies

ActionScript 2.0 :: Change Width And Height Of Movieclip?

Mar 19, 2000

I'm making a program like roomplanner at [url]..

I need to know how to change the width and the height of the movie clip. I know how to scale x and y but that doesn�t work in my case because i have for example an object which height is 75 pixels and width is 137 pixels. X scale and Y scale would work if my objects were 100 pixels width and 100 pixels height.

View 4 Replies

ActionScript 2.0 :: Getting The Width Of A MovieClip After New Image Was Loaded On It?

Aug 22, 2010

I'm doing an image gallery from xml file, and the thumbnails have diferent sizes. Around the thumbnail there is a border, both are diferent movie clips (thumb and border). they reside inside a main movieclip wich is being duplicated.

So I need to resize the border according the new size of the thumb movieclip, but flash actually gets the value from the starting value of the thumb, not the size after the file was load on to it.

I just thought flash would read the new value if i set the var for the width after the load movie, but that ain't happening =(.

My code so far:

Code:
function createButton(newObj, thumbNode, bigImageNode){
duplicateMovieClip(thumb_base, newObj, depthCount++);
var tempName = eval(newObj);

[Code].....

View 3 Replies

ActionScript 3.0 :: Movieclip Stops After Width Change?

Nov 4, 2008

It's not my first time with flash, but it's with AS3. I'm having a problem and i don't get it. I'm working with Flash CS3 PRO.

The thing is that i'm working in AS3 with a movieclip. That movieclip has more nested movieclips within. So I've: + bicycle_01 ++ body_low

body_low is animated in bicycle_01. I've created a class that will manage my characters. (This is for a cyclist ranking). So within my main file I create the cyclist. I haven't even started and i found the first problem, i'm trying to change the width of body_low but it freezes. After i change the width of body_low, bicycle_01 stops playing.

Here is my problem: _cyclist.getChildByName( "body_low" ).width = 10;

If I add this line body_low width changes, but the animation stops. (right movieclip in this example)

View 1 Replies

ActionScript 3.0 :: Embedding A SWF Inside A MovieClip - Width = 0

Apr 5, 2011

I have a class that extends a MovieClip and receives a MovieClip inside it. The movieclip is embedded like this:
 
[Embed(source='assets/emi_dir.swf')] protected var MyMovie:Class;
 
and I add it on the Parent constructor like this:
 
public function Item(content:DisplayObject) {
super();
var lines:Sprite = new Sprite();

[Code]....

When I add a Bitmap the Parent Item grows to accomodate the child, but this do not happen with SWF's...

View 6 Replies

Actionscript :: Flash MovieClip Width And Height Always Zero

Jan 26, 2010

I'm loading a flash MovieClip (Test.swf) like below. The problem is I can't read the size of mc (mc.width and mc._width both return 0, for the height as well), but I need to scale it. I have the stage size, I can scale, but I don't have the size of Test.swf, so I can't scale it to fit into the stage... ActionScript2, not actionscript3. If it was 3, I could get the value from the loader, but with as2??? The problem is I don't have control over the swf I load, so I can't put it's dimensions in the first frame...

[Code]...

View 1 Replies

ActionScript 3.0 :: Why Get Wrong Movieclip Width/height

Jul 8, 2010

I've a movieclip in my library ready for export to ActionScript. It's width and height is (723, 614.05), but I tried to put it on stage manually and check. When I get the item from library in ActionScript i get that's it's width and height is (743.65, 626.75). How can that be possible?

View 9 Replies

ActionScript 3.0 :: Change Width And Height For MovieClip?

Aug 13, 2010

I know there have been several similar posts but of those I've read, there hasn't been an easy straight forward solution that will work dynamically. The solutions posted have ranged from

super.width = wvalue;

super.height = hvalue;

which I did not get to work, and it seemed from the response to the suggestion neither could the person who originally asked for help, to suggestions about using scale, all the way to having to create an event handler that will get notified after the load, which I guess would work once but wouldn't work dynamically.

Here is the scenario -

I want to change width and height for a MovieClip, but I dont want to scale it, (its more like cropping the MovieClip, not shrinking or stretching) and I want to do this several times not just after the load of the MovieClip.

So my questions are:

1) Is there anyway to do this that really works, that hopefully isn't totally convoluted?

2) Why is it so hard to do this in Flash/AS3?

View 2 Replies







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