ActionScript 3.0 :: Cleaning Up Hardcoding?
Jun 8, 2009
I've created a map with the 50 states. I then hardcoded this so that when you hover over them the alpha is set to .5, and if you click on when it's ChildIndex is set to -1 and it plays the animation of the state growing to full size. I know there is a better way to do this, rather than how I wrote each line of code for each of the fifty states...
I'm also trying to play an outro animation "down" after the state is clicked while it is enlarged from the "up" animation.I also tried to create a var state so that when you mouse off of a state the state is no longer highlighted, but I ended up doing a work around using currentframe=.
Code:
//import flash.events.MouseEvent;
var small:int = 1;
var big:int = 2;[code]....
View 6 Replies
Similar Posts:
Jul 9, 2010
I have a custom Flex Container component written in AS3, called StatisticsContainer. When used in the application, it contains various custom Label components called StatisticsBoxes. So there might be a StatisticsContainer containing 3 StatisticsBoxes: "averageAge", "divorceRate" and "infantMortalityRate".
The StatisticsContainer needs to be able to reference and operate on all the StatisticsBoxes. However I don't want to hard-code the references into StatisticsContainer, as there will be various different instances of StatisticsContainer with different StatisticsBoxes in them. So how do I dynamically give StatisticsContainer an ArrayCollection of all the StatisticsBoxes it contains?
So far I started with a function like this in the creationComplete of StatisticsContainer:
[Code]...
View 2 Replies
Mar 2, 2005
I have a stage that's filled with dynamically generated isometric objects [ in the shape of a smiley, placed according to an array ], and when i click a button, i would like the stage to be cleared, then another frame with another isometric code and another array to load.The problem i am facing now is that the items positionned from the smiley are still on the stage if the next array is smaller than the previous one.Currenlty, i triedunloadMovieNum(depth) in between with this code:
Code:
n = 50;
onEnterFrame = function(){
[code].....
View 8 Replies
Jul 29, 2009
if you have object inside of object inside of object ... etcwhen you want to completely remove it is it enough to just say:removeChild(topObject);or you need to go inside and start cleaning from there?
View 3 Replies
Apr 16, 2011
I'm trying to clean up my code for an animation I created. I'm hoping by doing this, my animation will stop being as buggy and/or I can more easily figure out why its being buggy. think that variables are the way to go so I read up on them and have a decent idea of what I need to do. But what sounds good in my head doesn't seem to work on screen.So basically I would like to take my three buttons called card1, card2 and card3 and combine their functions. All the code for each button looks exactly like the code below (except for the mc name of course)
Code:
card1.addEventListener(MouseEvent.ROLL_OVER, overhandler);
function overhandler(event:MouseEvent):void {
[code]....
View 8 Replies
May 8, 2009
The reason why I'm writting it's because I'm doing a website in Flash, and I don't know how to do one thing.I can create the TextArea, it's ok by now. But what I want to do now it's create 2 buttons. In the first, the "Clean" button, if I clicked on him, the TextArea delete everything it was written there, and in the "Send" button I send an e-mail to one e-mail, with what was written in the TextArea.
View 7 Replies
May 11, 2009
I got on stage a bunch of squares (sprites), so when the browser change size, I need to re-draw this squares and re-calculate max numbers of that can fit on the page, and so on..., my issue is I call three functions in the resizeListener
clearPage();
setupPage();
drawSquares();
[code].....
View 5 Replies
May 25, 2009
I had Flash 8 on my computer, and back when CS3 came out I purchased the full suite and installed that. Yesterday (years later, now) I was cleaning up installs on my computer to free space. I used Control Panel to remove Flash 8 from my PC.Now Flash CS3 still launches and works, but I cannot get .swf files to launch on their own at all. When I double-click them to open them, I get the message:
The file does not have a program associated with it for performing this action. Create an association in the Folder Options control panel. I've googled to figure out what that means or how to do it, but I haven't found a decent reply that's been effective. If I try to drag a .swf into a browser window (or just open it with a browser), it is also not recognized. Oddly enough, I can view Flash files on web pages no problem (when browsing online)...
Some necessary components must have been removed when Flash 8 was installed. I suppose I could try re-installing Flash CS3, but the problem with that is that I'm out of town on business for the next 10 days. My Studio install discs are back at home, and I need to get work done this week!.
View 3 Replies
Oct 29, 2009
I have an array that when traced, lets say looks like
Code:
Carrot,Apple,Strawberry,,,Cantaloupe
I'm just wondering, what's the best way to tell if an element in an array is empty?
View 4 Replies
Jun 26, 2011
I'm a relatively experienced programmer, but I'm completely new to as3my question is how can I remove one object and subsequently all it's child objects and their listeners?I need to remove all objects from a certain object called "world". My objects are all on top of this "world" object. the game has a level object which is on top of this "world" object and it produces enemies among other things on an enter frame event.To remove this from the stage I call the world.destroy() method from the main timeline.
Code:
// * Destroy the world
public function destroy()
[code].....
View 5 Replies
Nov 14, 2011
Lets say a scene started off around 70-80mb, it loaded a swf in, and by removing the event listener and setting objects to null and numbers to 0 before unloading the swf,and went back to the original scene, the memory stack up till like 80mb++, and every time I repeats the same process the memory goes up higher,is that normal? or its a memory leaking issue?
View 4 Replies
Mar 27, 2012
As a best practice should trace statements be removed form all AS once we're on the final files? Or does it not matter and therefore best for future reference to leave them be?
View 3 Replies
Jul 21, 2009
I have a working rotating menu that I have been changing to suite what I am trying to acheive. it all works apart from the distance between images which I can sort out later. At the moment the movie has a UI which I would rather remove including the script that makes it function just leaving the rotating menu, and the script to change the radius and size etc witin the main.as. I do not want the user to have the capabilities of the UI control panel. remove and clean up the script as everytime I remove related script the menu stops playing. I have uploaded files to here: [URL]
View 1 Replies
Feb 20, 2012
I want to display HTML formatted content from various sources inside a Flash Flex application. Flash supports HTML formatting in its text fields, however it is very limited compared to a web browser. Are there any scripts out there that will convert common HTML formatted text into a format that Flash can handle? My particular use cases are:Displaying HTML formatted emails inside FlashDisplaying RTF files inside Flash (after running an RTF2HTML conversion on the server)Displaying random HTML content copied and pasted from other sources into Flash
View 3 Replies
Mar 2, 2005
I have a stage that's filled with dynamically generated isometric objects [ in the shape of a smiley, placed according to an array ], and when I click a button, I would like the stage to be cleared, then another frame with another isometric code and another array to load. The problem I am facing now is that the items positioned from the smiley are still on the stage if the next array is smaller than the previous one. Any way I could clear the stage before going on the next frame? Currently, I tried unloadMovieNum(depth) in between with this code:
Code:
n = 50;
onEnterFrame = function(){
trace(n);
n--;
unloadMovieNum(n);
if ( n<=0){
nextFrame();
} else { stop(); }
}
What happens is that it clears the stage, but doesn't load anything in the following frame.
View 8 Replies
Aug 19, 2009
I have a bit of code that calls a custom class that I made in flash. Basically when you roll over this logo I have a function that makes a new instance of a custom class and calls it to the stage like a little pop-up text when you roll over something. Then when you roll off of it I remove it from the stage. The following code is for the first pop-up text.
[Code]...
View 2 Replies
May 12, 2011
I have made a game that after you reached a certain object it will switch to the next level. The next level is in a new layer and in a new frame. Problem is I think all of the properties (speed, collions etc..) have been inherited... Meaning my charachter will move on his own and collisions will still apply for objects if the previus frame.
Is there some kind of way to clean all of the properties and have "fresh" start? I have tried to clean the Array that detects the collisions, the collisions work now. But the player now is 2x faster and also jumps 2x higher... I don't have the code to past in here right know, I will add it later. So, summing up. Is there some kind of way for me to clean the properties of objects from one frame to the other?
View 3 Replies
Nov 14, 2011
I'm trying to do a cleaning of some classes that is added into a MovieClip, but I can't seems to set the MovieClip(Class) to null. What is the proper way to do it?
private var mcHolder:MovieClip = new MovieClip()[code].................
View 1 Replies