ActionScript 3.0 :: Keeping Large Objects From Affecting Stagewidth?
Aug 22, 2010
I have a large movieclip that I am adding to the stage (large in dimension, not filesize). Once it is there I plan to manipulate it's X position by clicking different parts of the movieclip. Unfortunately, where I am moving the clip to is based on stage.stageWidth, which changes as soon as you add this movieclip to the stage. So I can't make any accurate tweens or anything like that. Is there a way I can set objects to not affect the screen width when they are loaded? Or still access the property of the actual window's width?
View 3 Replies
Similar Posts:
Dec 11, 2003
i'm trying to adapt a .FLA from flashkit.com which creates a "tree"at present, there is an MC of a line with a round button at the end.
this MC is played on startup - clicking on the button plays the MC from the centre of the button out in a random direction, creating another branch. the result is a tree-like design. - you can see a test here:
[URL]
I want to adapt this so text can be added to each "node", however, i have realised that as each branch is just the MC rotated, any text (or any kind of design dependant on vertical alignment) could be upside down.Would it be possible to "start" a seperate MC (which would be vertical at all times) at the end-point of each new node-MC?
View 2 Replies
May 12, 2007
I'm using a vCam to zoom in and out in my game, but I need a HUD system to stay at the right _xscale and position. How can I do this?
View 1 Replies
May 23, 2010
I am creating a site with lots of big scrollable text-boxes in it. Each text-box object contained some text, and two buttons to scroll up/down with. The scroll buttons each had an event listener so the text moved when you clicked them.
These text-boxes were stacked on-top of each other with all except one having an alpha of 0. If I wanted to change which text-box is active I move it to the front and call a small TweenLite animation.
To the left (outside of the text-box objects) I have an object similar to a menu. It also has about 12 or so event-listeners (one for every button).
This turns out cause A LOT of lag an it's very troublesome for my laptop to run it. reduce the number of event-listeners on the stage and also the amount of text-boxes.
What I was thinking was to add the text-boxes using AS so I only have 1 on the stage at a time but I couldn't figure out how to do it. I also thought it might be better to just use 1 big event-listeners and from mouseX and mouseY decide which button the user is trying to push.
View 1 Replies
Oct 12, 2010
I am preparing a navigation (using panning) movie in Flash. There is very big (6000x4000) image (area photo from top) on the stage and it's position moves once user moves his mouse. Thus, user can navigate on the area.But flash really drives me insane while working on this movie. It usually suddenly stops and quits with error.I'd like to ask what can i do? should i use a different method???It seems, Adobe becomes stupid on large files and there are bugs in somewhere Flash. For example; how can i use a method like Google Maps (it loads an another image when you move another position. Not loads all images together and doesnt consumpt large amount of resources.)?
View 1 Replies
Feb 5, 2011
I've been working on an old flash project from a few years back and ran into a little trouble with filters.My program requires the ability to zoom in to any zoom level, which works perfectly fine. And now I've made it so the selected object would glow with the use of Flash's Glow Filter.The problem which has arisen, however is that I get a warning message: "Warning: Filter will not render. The DisplayObject's filtered dimensions (4154, 4154) are too large to be drawn."Now obviously I understand why this would occur, however I'm wondering if there is a way around it. My first guess was setting up a screen size mask, obviously way lower than the max resolution hoping that cull the movie clip to the size of the screen, but that was unsuccessful.
Is there a way to dynamically clip objects and if so would that work? As surely if I could clip the object in run time to the bounds of the screen, the resolution would never exceed that of the screen. If not, any other ideas as to how I can make a large object glow?URL...Also there's dl.dropbox.com/u/956557/Glow/GlowTest.fla if you want to take a gander at the source for that.
View 5 Replies
Oct 12, 2010
Part of a larger presentation I've made, there is some background music. What happens is an XML file is read to get a file to play. It plays. When it finishes, it reads the XML again to get the new file. It can also stop when a video plays elsewhere in the presentation then I pick it up where it left off and start the process again. Trouble is, the presentation randomly stops. The music stops and the slides in the presentation stop. The music and slides come from a single XML file. There's also a third part of the presentation (a text crawler) that never stops.
This comes from a totally separate XML file. I never get an error, the presentation just stops on a slide and no more music plays, but the crawler keeps crawling. I've removed all the code for the music and it runs perfectly so it's obviously related to how the music is managed. So, finally, my question is how do I manage sound objects? If I need to create new objects for each sound I load and play, I'll need to do manage the sound from a single function, right? Something like:
Code:
function whatever():void {
if song is not loaded {
read xml, load and play song;
} else if video is playing {
pause the song;
} else if video has stopped playing {
resume song;
}}
View 4 Replies
Jun 10, 2009
I'm building my first Flex custom component, in Flex 3. It is a data table based on the 'Grid' container class, with a simple text Label in each cell. (DataGrid and AdvancedDataGrid were not appropriate starting points for my needs.) The component works quite well using smallish tables, but I tried stress-testing it using a larger table, and have been disappointed by the results.
The component creation process has some slow spots, but those are in my power to optimize and aren't my primary concern. What worry me more are what appear to be limitations in the Flex framework itself.
This 'large' sample table has a bit over 7000 cells in it. This is largish, but still 1-2 orders of magnitude less than the biggest I need to accommodate. In standard Grid structure, the main portion of the component consists of a Grid with 400 GridRows of 16 GridItems each, plus a few other smaller ancillary Grids.
Once the table renders, I find the following:
Mouse-related events are slow to fire. Specifically, I have rollOver/rollOut event handlers registered on each table cell, to let me highlight the cell under the pointer. On a small table, I could move the mouse over the table very quickly, and the highlighting would follow the pointer in real-time. With the larger table, the highlighting is very jerky, changing only about twice per second, skipping over many cells.If I place the mouse cursor over the component and leave it there, my CPU is pegged (one processor core, anyway), and stays that way until I move off of the component, when it drops to idle. My component isn't doing anything at all at this point.
It feels like Flex simply cannot scale to support component trees that are this large. I shudder to imagine how it would behave with 100,000 cells. Perhaps I'm pushing the Grid beyond its intended use, but having an object per table cell doesn't seem like an unreasonable model, and ~14,000 objects in the tree (a GridItem and a Label per cell) seems pretty modest.
View 5 Replies
Mar 5, 2010
I'm trying to think of the best way to add event listeners(mouse events) to an invisible object which is quite large. A straight forward way I can think of is probably setting the object's alphy property to 0. However since that object is very large, it will probably have a huge impact in performance. Setting invisible to flash however, will stop it listening to events.
e.g. I have a massive area 4000x4000, but I only want the 2000x2000 area to listen to events.
Other methods I can think of is to have the smaller area in the layer below the big area, covering it from view, though I'm not sure if the lower layer can pick up events? another way is maybe just have the big area listen to events, but in the handler I'll write some code to check if its within the boundary of the smaller area.
View 6 Replies
Nov 7, 2009
I am working on a project where I need an interactive matrix of 500x500 clickable lements. I thought this would be an easy task in actionscript3 but boy was I wrong. was able to create a matrix where each element was a Sprite object with attached Mouse click event. But here the performance problems begin. FlashPlayer10 can handle up to 100x100 matrix, but when I increase my matrix I start getting script timeout in browser player... Here is how my "unfinished" matrix looks like.
So how should I approach this problem? I was hoping flash will be able to handle so many elements, but I guess I was wrong. I want to have a pan control to pan around for objects off screen and of course zoom in/out control.It's true I'm not very professional in Flahs and actionscript but a friend who is told me this would be no problem implementing in AS3? I need this in flash as the thing needs to be hosted on website (unless there is a better tool for doing something like this...).
View 12 Replies
Jan 11, 2011
I'm devloping some library classes for flocking/steering behaviours on large numbers of objects (2000+). I'm finding that at < 500 instances, performance is reasonable. As the numbers increase, framerate bogs down.
I've seen remarkable performance with libraries such as Flint or Box2D with ridiculous #'s of particles / objects, so it should be possible to optimize / refactor my code to be a bit better.
I'm aware of the basic optimizations, such as bitwise operations and optimized for loops. Are there any more fundamental approaches I should be considering? For example, currently each instance is a vector-based MovieClip. Would working with BitmapData be more efficient?
View 1 Replies
Apr 8, 2011
I am trying to get the stage width of the FLA in as3. Obviously, stage.stageWidth works well, the only issue is that when viewing the the SWF in an HTML page when you are zoomed in or out it gives you the relative width of your current view. For example, my stage width is 800x600 and when I trace out the stage.stageWidth it is showing up as 800 as long as I am viewing in my browser at 100 percecent, but once I zoom out in my browser the stageWidth gets traced out as a smaller number. Does anyone know how I can dynamically get the stageWidth of the FLA and have it not change regardless of how you are viewing the HTML page
View 1 Replies
Nov 14, 2010
I use mxmlc to compile as file,I use default stage.stageWidth to draw some grahpics,such as:
[Code]...
View 1 Replies
Jun 15, 2010
I have a 2 swfs, home.swf loads into main.swf. However the stageWidth/Height that I defined they are now pointed to main.How can I get stageWidth and stageHeight pointed to home.swf instead?
View 1 Replies
Nov 15, 2010
I use mxmlc to compile as file,I use default stage.stageWidth to draw some grahpics,such [code]...
View 2 Replies
Feb 11, 2003
how to get a button in one flash file to affect what happens to another fla? Cause Im trying to get an swf that has been opened by another swf through the loadMovie function (which I�ll call swf a) to open another swf inside swf a.
View 3 Replies
Dec 16, 2009
When I test the swf straight from Flash, the stageWidth is 800 pixels. This is correct. When I load the swf using an HTML page in Firefox, it tells me the stageWidth is 0. I've stripped the whole thing down to just the following script and slapped a bright green frame into the first layer of FLA so I can see the edges of the stage. The SWF is displaying at 800 X 800 but the number displaying in the text field is "0" in a browser, and "800" when the swf is playing stand-alone.
package com.maijag.threedee{ import flash.display.*; import flash.text.TextField;
public class SwarmTest extends Sprite { private var myParent:Object;
public function SwarmTest() { myParent = this; // this textField is just to see what the stageWidth is in
[code]....
View 6 Replies
Dec 23, 2010
Actionscript Code:
// button pressesupKey = 38;downKey = 40;leftKey = 37;rightKey = 39;focusKey = 65;attack1Key = 83;attack2Key = 68;bombKey = 81;autoAttack1Key = 87;autoAttack2Key
[Code].....
Rather than affecting one variable, one key press makes all the others true as well
View 2 Replies
Sep 5, 2010
I'm trying to get the width and height of the stage to position my objects when the user resizes the window, but I can't figure out how.
I've Googled a lot and found some examples and my last try looks like this [code]...
View 4 Replies
Mar 13, 2009
I have a movie clip, in this movie clip there is a mask. I have three layers in this movie clip, 1. the mask, 2. the item being masked, 3. back ground object. When I click on the movie clip on the stage it gives me a width of 150. 150 is the width of the Mask, layer 1, and the back ground, layer 3. trace(movieclip.width); gives 175. 175 is the width of the item being masked on layer 2 of the movie clip. Is this a quark? or is there someway to get the width of the movie clip like when I click on it in on the stage?
View 2 Replies
Jan 18, 2010
I have x amount of MCs arranged vertically with the distance between each being the same. When I roll over any of them the X & Y scale increases for that particular MC with a tween and on roll out they decrease to the MC's original size. Here comes the sticky bit...how can I maintain the distance between each when the scale of an individual MC is increased/decreased? I have attached a basic swf to show you what I mean. (Only the middle MC is active).
View 6 Replies
Oct 27, 2009
I have this code that makes a menu with two buttons appear following the mouse when the mouse rolls over a movieClip:
Code:
var imgOptions:menuMC = new menuMC();
//Makes the image options follow the mouse
function showImgOptions (e:Event):void
{
[code]..
The problem is that the buttons are children of imgOptions, and when the mouse is over these two buttons, the movie reacts like the mouse is not over the imgOptions movieclip.
View 1 Replies
Sep 2, 2009
So I'm trying to do a simple graph with rollover definitions. I have the graph on one layer in the root along with the definitions. On a hit testing MC I have the following:
var defbox:info = new info();
var mcName = this.name;
var xPos = (MovieClip(parent).stage.stageWidth)/2;
[code]....
View 5 Replies
Sep 10, 2009
How do control the stagewidh and stageheight Using script in AS3?
View 1 Replies
Oct 8, 2010
Experimenting with Flash as usual.Preloader's are always something that have caused me trouble.Here's what I typically use for a timeline based preloader in AS3:
this.addEventListener(Event.ENTER_FRAME, loading);
function loading(e:Event):void {
var total:Number = this.stage.loaderInfo.bytesTotal;[code].......
I'm really interested in a preloader that loads right across the stage however - regardless of if the stage is resized.I should imagine it'll involve implementing = Math.round(stage.stageWidth); at some point?
View 9 Replies
Feb 18, 2012
I am trying to set masks and other component positions in relation to Stage size.AS3 CS5I trace stage.stageWidth on a 800x600 pixel stage and I get - 100My stage will scale within a Director piece.Is this a bug? Modal condition? Releated to scaling??
View 7 Replies
May 31, 2010
I'm having issue regarding the display when using Firefox 3.5 on MAC, I can see my menu and the display is correct. The menu just position above what it supposed to be positioned. It works fine with Safari on MACOSX.My flash size is: 1440x750It looks like Firefox can't recognize stage.StageWidth and stage.StageHeight. It returns 0.Some suggest implementing was to pass in the actual width and height of movie via FlashVars. The movie uses these instead of stage.stageWidth and stage.stageHeightDoes anyone have an example of code of how to fix that issue??
public function Main()
{
addEventListener(Event.ADDED_TO_STAGE, handleOnStage, false, 0, true);
[code]....
View 1 Replies
Apr 20, 2011
I have a full-windowed SWF running in Firefox3.6.Reading stage.stageWidth should follow the size of the browser's window, but that's not the case with Firefox! The minimum stage.stageWidth I get is 925, even if I make the Firefox window much smaller than that.stage. stageHeight seems to work fine though.This is because the (my?) Menu Bar won't go below 925 pixels wide. The problem is solved if I hide the Menu Bar!
This problem only appears on Firefox. Anyone knows if there is a work around? I can't ask users visiting my site to turn their menu bar off in order to see it correctly.
View 1 Replies
Jan 7, 2009
I created a custom class in a .as file. I then linked this custom class with a symbol from the library in my .fla file. However, I can't reference stage.stageWidth in my custom class file. I get a null object error.
I think this happens because the custom class file is associated with a symbol on the stage and not the stage itself. For example, if I set the fla file's Document Class to the name of my custom class I can reference stage.stageWidth in the custom class. But I don't do this because I am creating multiple instances of the symbol on the stage. In order to do that properly i found I have to set the class in the properties panel of the symbol to the underlying class which then defines how each symbol behaves.
Under this type of linkage, is there a way to reference the stage width from the class? I've tried root.stage.stageWidth and parent.stage.stageWidth to no avail. I also made sure to import flash.display.* in my custom class. Below is the code for my .fla file and my .as file. In the .as file you'll see the line "x = Math.random() * stage.stageWidth;". This is the line giving me problems. I could hard code it, as I do for the y variable on the next line, but I'd prefer not to in order to keep the code flexible.
[Code]....
View 3 Replies
Sep 19, 2009
The old loaded swf issue. How can I keep the dimensions of the loaded SWF to that of its FLA, and not to the new stage where it is loading? I know there is only one stage, so i just have to hard-code this into the loaded SWF right?
View 9 Replies