Flash :: Dealing With Many Objects?

Mar 2, 2012

I am making a strategy game and came across a kind of problem. Basically, I don't know how to deal with the dynamic creation of the units I need. Should I use some big switch statement or is there a more ideal solution?

View 3 Replies


Similar Posts:


Actionscript 3 :: Dealing With Display Objects On The Stage?

Oct 3, 2011

I think there are 2 different practices with dealing with display object on the stage.You draw all the objects on the stage and then manipulate the "visible" attribute to show or hide them.You use addChild and removeChild to manipulate the visiblity.How do you think what is the best method for this?

View 3 Replies

Flash - Dealing With A Transparent Png File Symbol?

Oct 5, 2011

In my project, there is a frame(png files) placed on the top of all symbols. After that, I apply mouse click event to the symbols that place underneath the frame symbol, but when I run the the game, I cannot click to the below symbols but only the frame symbol, although the frame is transparent.

The problem is, although the png picture has some transparent area, the mouse click cannot pass through it. Is there solution? Is there anyway I can disable a symbol from being clicked and mouse click event can recognize the symbol placed under it?

View 1 Replies

ActionScript 3.0 :: Flash Dealing With Parents / Children And Setting Things To Null

Jul 12, 2010

Seeing as I don't have too much formal education Flash/OOP in general, this is just one of those thing I can't seem to quite deal with gracefully. All I'm trying to do is to be able to load/reset my an instance of my game's main class (not the first class that gets pulled up by Flash, but the one that actually has games logic in it), which of course extends MovieClip. It took me a while before I could even make an instance in it, because it would silently crashed when I would try to do so, and what didn't help was that the output window stopped working, and I had to completely reinstall flash. As far as I remember I simply fixed it by taking out the "stage." from any of the lines of codes that had it.

[Code]...

View 6 Replies

Flex :: Dealing With Namespaces In E4X

Dec 14, 2011

I'm trying to get data from a namespaced xml file in a flex app. There is a root namespace (xmlns="blah") and another namespace (xmlns:i="blah"), and I'm able to access most tags using the following:
var ns:Namespace = doc.namespace();
var result:XMLList = doc.ns::element;

However, there are several tags that are subject to change in the application, and i'd like to not hardcode them, possibly using the elements method:
var result:XMLList = doc.elements(configuredField);
Is there a way to get elements with namespaces using the elements method, or a similar way to get XML elements in flex using a parameter?

View 1 Replies

ActionScript 3.0 :: Dealing With XML And Validation

Dec 7, 2009

I'm making a small memory game that is XML driven (users can upload images into the game). I've come to the point where I need to check if the user has filled out certain nodes or not, and if so; check that the input is valid - int when int is expected and whatnot.

What are the ways to check this, and which is best? So far I've only tried checking if a node is == "" or not, but I imagine there must be better ways. I will include lots of switches for the user which should all be optional. This calls for a neat way to validate it.

View 1 Replies

Actionscript 3 :: Air - Library For Dealing With OpenSoundControl?

Aug 14, 2011

I would like to send and receive OpenSoundControl in an AIR application, on the opensoundcontrol.org website I have found existing libraries for many languages, but none for Action Script so far, do you know of one that could be readily used?

View 1 Replies

ActionScript 3.0 :: Dealing With Positioning In FULL_SCREEN?

Apr 23, 2009

I have an app that has a fullscreen button that goes into fullscreen NO_SCALE. Keeps everything looking sharp. However, all of my movieclip positions aren't correct. To fix this, I need to use:

Code:
stage.addEventListener(Event.RESIZE, stageResize);

Then, in my stageResize function, I duplicate all my movieclips' x and y and (if necessary) widths. This seems wrong and cumbersome.

Here's an example of what I'm talking about. Full Screen - Doesn't Work Clicking on fullscreen brings you to fullscreen but the mc positions stay put. Here's the code for this one:

Code:
var btn_fullScreen:btnFullScreen = new btnFullScreen();
var btn_normalScreen:btnNormalScreen = new btnNormalScreen();
var bar_bg:barbg = new barbg();

[Code].....

View 3 Replies

ActionScript 2.0 :: Everything Dealing With SharedObjects In The First Frame ?

Jul 1, 2009

Everything dealing with sharedObjects in the first frame is this:

[AS]
var PlannerData:SharedObject = SharedObject.getLocal("PlannerData");
SubjectChoices = PlannerData.data.subjectChoices;
if (SubjectChoices == undefined) {[code]....

Going to the second frame from the first frame, the data is perfect. Going back to the first frame from the second, I'll trace the data many times throughout the code without an onEnterFrame, and it'll tell me that the Array is good...But when I trace the onEnterFrame, it shows the Array is [undefined, undefined, ...] like..undefined 17 times.

View 1 Replies

Professional :: Dealing With Layers From Duplicated Scenes

Jul 28, 2011

I'm using Flash CS5.5. I had some unfinished work on flash 8 and I'm running actionScript 2.0  In one of my scenes I had come up with a good button set up I wanted to use in all of my scenes. So I duplicated the scene, and proceeded to re-name my layers on the new scene according to the new content in the form of bitmaps. Well, on the output I got warnings such as: "duplicated label on layers". My SWF is still showing normally but I don't know what to do with the warnings. Is there something I should have done other than double clicking directly on the old labels on the layers and chaging their name?

View 1 Replies

PNG File Validation - Dealing With Untrusted Images?

Mar 9, 2010

I have a Flash web app which displays user submitted PNG files. Files are uploaded to the server via some API prior to being displayed. I'd like to make sure no "bad" files are served to Flash, where "bad" is entirely unspecific. Is there a way to validate PNG files against the PNG specs (this would catch corrupted files)? Or any best pratice on dealing with untrusted image files? I only need to handle PNG, so JPG, GIF etc. support is necessary. Language mostly does not matter, though I'd prefer Python solutions. This is on a Unix webserver.

View 1 Replies

Flex :: Dealing With Automatic Adding Scrollbars?

Sep 3, 2010

I'm creating a container and it's content at runtime. Here's a rough structure:

--VBox
----Form
-------FormItem

[Code]...

I've tried also validateNowand other similar methods. What I have here:

1. The HScrollBar is being added.

2. We increase a bit the width of container, so it disappears.

3. When it disappears, the validating throws the null-pointer exception when it tries to measure the non-existing scrollbar. I've also tried to add validateProperties before validation, but it didn't worked either.

View 1 Replies

Actionscript 3 :: Dealing With Sequence Of Functions Linearly?

Jun 25, 2011

I want to have a series of functions that execute one after another instead of one within another.

here's what I mean

[Code]...

View 2 Replies

ActionScript 2.0 :: Dealing With Options In A Program Along All The Scripts?

Mar 19, 2007

How do professional programmers deal with preferences for their application?when there are options to be chosen in an application, does the program is full of "if" to detect what option has been chosen?Let's say that there is a call to 30 functions in the program.But the user has got to choose between an option A or B that would modify the way those 30 functions work.Would you have to write 60 functions and then place an "if" condition each time to go to the needed one...

Or would it be possible to write at run time (after the program has read the preferences) the corresponding functions? So that it wouldn't be necessary to check conditions each time?The goal being to gain total speed in critical functions preventing their run to be slowed down by condition requests.

View 2 Replies

ActionScript 3.0 :: For Loop - Dealing With Associative Array?

Jul 16, 2011

I have an associative array of values called definitionsArray which I use as references to instantiate classes in a run time shared library.I instantiate and push the object into a new array. The problem is when I try to access or do anything basically with that new array.As they are objects they don't seem to like being in a display list for example.

HTML Code:
var definitionsArray:Array;
var bubblesArray:Array;
var currentBubble:*;[code]...

View 11 Replies

Professional :: Dealing With Loop To Part Of Time Line

Dec 21, 2010

I need to adapt it so that instead of looping all the way back to the beginning, it instead goes to points further into the animation (such as say 10 seconds in) rather than all the way back to the start.[code]Now, I'm thinking that what needs to be changed is the autoRewind = true section, but being a complete novice, I don't even know where to begin. I've seen online sections dealing with a goto command, but my attempts to alter the code haven't worked correctly

View 4 Replies

ActionScript 3.0 :: Masks Dont Function When Dealing With 3d (properties)?

Dec 29, 2010

I can find in the Adobe's help that masks dont function when dealing with 3d (properties). In this case I stuck on big obstacle in my project,where I wanted to deal with masks, and .z property. I wanted to tween mainMovieClip via TweenLite to make it going away from view.mainMovieClip has mask inside it ( added by the code), and certainly after tween is done mask is unaplied anymore, what is more disgusting functionality for eventListeners (clicks) attached to movieClips behind the mask gone far away. So in the end mask does not work, and everything behind it doesnt too..I need some specialist if my approach to the problem could be somehow a solution. I tried by it doesnt seem to work:I thought that if before tween I would disable the mask, by just setting

mainMovieClip.someMaskHolderMc.mask = null; 
and then after tween is done, I could re-set it:
mainMovieClip.someMaskHolderMc.mask = someMasker;
 
but I end with nothing though, apart of that after tweening I can click once of the areas I had eventListeners before the tween, and then
all functionality disappear. Masks do not work too .

View 2 Replies

ActionScript 3.0 :: Way Of Dealing With 'implicit Coercion' Of Array To Sprite?

Apr 18, 2011

With continued help from this forum I am getting closer to having a working program. I look forward to being able to help others like myself once I finish learning the AS3 ropes.I have created a 12 x 9 random number grid that populates each cell with a corresponding image based on each cell's numeric value. I have also created a shuffle button that randomizes the numbers in the grid. The problem I am running into is getting my button-click event to clear the current images off the grid in order to assign new ones (i.e. deleting the display stack objects in order to place news ones in the same locations).My question is this: what is the best way to handle an implicit coercion from an array to a sprite? I have pasted my entire code below so that you can see how the functions are supposed to work together. My trouble apparently lies with not being able to use an array value with a sprite (the sprite represents the actual arrangement of the grid on the display stack while the array starts out as a number than gets assigned an image which should be passed to the sprite).

View 10 Replies

ActionScript 3.0 :: Dealing With An IOError (Errors 2044, 2032)?

Aug 5, 2010

I'm trying to deal with an error that happens when an XML files is "loaded" that doesn't exist.Line that causes the error:

Code:
loader.load(new URLRequest(url));

I've tried putting a try catch(e:Error) around it, I'm tried an event listener for IOErrorEvent:IOError, but I can't seem to deal with the error.

Error message:Quote: Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: [File Name] at blah blah.....

View 4 Replies

ActionScript 3.0 :: ''if" Statements When Dealing With A Stream Of Sensor Data?

Apr 17, 2010

After a not inconsiderable effort I've managed to get a touch sensor attached to a microprocessor talking to flash. It gives a constant analog input giving a value between 0 and around 300. When it reads 0, the sensor is being pushed hard enough, and my aim is to get an object to appear on the screen every time the sensor is pressed so that it reads 0.[code]Which works, when the sensor reads 0 it traces "zero", except it does it every time it reads the sensor, so there's huge great list of "zero"s generated.What i want is for it to trace "zero" only the first time it detects a zero, and not do it again until the value rises past zero and back down again.Is there a conditional way to do this? Something like "If previous value was greater than zero and this value is equal to zero, trace zero. if not, do nothing"?

View 2 Replies

Actionscript 3 :: Parsing A Large CSV File, Dealing With Commas And Quotes

Oct 12, 2010

I need to load in a large CSV file (>1MB) and parse it. Generally this is quite easy to do by splitting first on linebreaks and then commas. The problem is though that some entries contain Strings that include their own commas. When this spreadsheet is converted to CSV, the lines containing commas are wrapped in quotes.

I've written a parser that first escapes all the commas in these strings, then splits it on linebreaks and then commas, and then unescapes the values again.

This is quite a slow process for such a long string, as I need to iterate through the whole string. Does anyone know a faster or more optimised method of dealing with this?

View 3 Replies

Flex :: Objects Drawn By Flash Graphics Class Exist As Objects?

Jan 16, 2011

Internally Flash obviously keeps a list of the primitives drawn using Graphics so I wondered if you have many such primitives in a Sprite, can you re-position/remove/alter individual items rather than clear and re-draw everything? Or is this deeper into the bowels of Flash than you're allowed (or recommended) to go?

View 4 Replies

Flash :: Recycle Objects When Creating An Array Of Objects?

Dec 18, 2011

Is this the correct, most efficient way to recycle objects when creating an array of objects?

package com {
public class CreateList extends MovieClip {
//this is the object I will be recycling
private var newProperty:PropertyRow;
//this is the array I will use to reference the objects

[Code]...

View 2 Replies

Php - Flex Is Deserializing Generic Objects From Zend AMF Instead Of Strictly Typed Objects

Mar 4, 2012

I'm using Zend AMF to send my remote objects to Flex. I've defined a Constant class and created getASClassName() method. Then I've created Action script class in flex.

Objects are send successfully, but they are deserialized to generic Objects in Flex instead of specific ones. EDIT: On network monitor in Flex I can see that AMF value is set to com.my.project.valueobjects.Constant. Although array from event.result contains Objects.

[Code]...

View 1 Replies

ActionScript 3.0 :: Does Setting An Array Of Objects To Null Erase The Objects From Memory

Apr 27, 2010

I have an array of temporary objects created in a for loop. The objects are of type class "Tile", a class I created. However, it appears that whenever I create a lot of tiles in the for loop, the program slows down indefinitely.

While the array is whiped at a later trigger point, I am thinking that perhaps these Tile objects are not being erased from memory. They are being created on the fly in a for loop, and the array is being reset to "array = []".

Are the objects still in memory or are they cleaned up when the array is set to []?

View 3 Replies

ActionScript 3.0 :: Objects Class Find And Change Another Objects Xy Properties?

Oct 13, 2010

What I have is a game with a Level object, inside the Level is a Player object, and they don't have instance names given, what I'm trying to figure out is how to do is make it so that the player can change the x or y properties of the Level object.
 
To be more precise, I'm making it so that when the player moves in a certain direction, he either moves accross the stage, or he starts moving the Level object around the stage, it'd be in an Event kind of function, now I can easily make the Player move, but I don't know how to make the Level object move which the player is inside of.

View 3 Replies

Flex :: Converting Array Of ObjectProxy Objects To Custom Objects?

Jun 10, 2011

I have a service which returns an Array of ObjectProxy objects. I would like to cast this to a custom object (a value object) and create an ArrayCollection. How can I do this?ited:I am using Django and PyAMF for the backend. I had to write a custom SQL query and I am wrapping the resulting records in ObjectProxy and sending the whole result as an ArrayCollection.Here is my client side code:

[ArrayElementType("SessionVO")]
[Bindable]
private var _list:ArrayCollection;

[code]....

View 2 Replies

Java :: Why Value Objects Coming Back As Generic Flex Objects

Aug 4, 2011

I will try to give as much detail as I can. I am creating an CRM application using Flex(Cairngorm 2)/Java/Hibernate. The basic problem I am having is this: I have a Customer class in Java that has an ArrayList of Address classes. I have a Customer class in Flex that has an ArrayCollection of Address classes. When I make the remote object call for a Customer I get back a Customer object in Flex, but the ArrayCollecion objects have a data type of Object instead of Address. If I try to call for a List of Address classes I get the same result. If I try to call for a List of Customer classes I get a list of Customer classes in Flex. Using tomcat 6 with the following jars:

[Code]...

View 1 Replies

ActionScript 2.0 :: Aligning Variable Sized Objects And Objects Inside Them

Jun 29, 2006

How do I align a movieclip, which width and height is user-defined, inside another object (this one is static, though). Top-left alignment is easy, x=0 and y=0, but what about center, center left, bottom left, etc? Math(.round) i suppose, but how?I want an object (static) inside the movieclip (user-defined) to stay aligned to, for instance, the top right corner, similiar to the minimize, maximize and close buttons at the top right of your browser.. The height and width data is pre-defined by the user in another file.But that does probably not make any difference...

View 3 Replies

Loading Objects And Dragging Objects To Create New Instances?

Sep 22, 2009

I want to create a flash movie which firstly loads a selection of images/objects into a portion of the frame. After this is complete, the user can then drag these objects onto another area and the object will be created where the user has chosen. The user can then drag another instance of the ojects onto the area.

For example, there is a background of a lake in one area. A selection of boat pngs are loaded in an area below the lake. The user can drag these boats and place them on the lake. They can drag a boat multiple times if they wish.

View 4 Replies







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