In my application, I have a chart that I want to display in a TitleWindow when clicked on.
var win:TitleWindow = PopUpManager.createPopUp(this, TitleWindow, false) as TitleWindow; win.addChild(myChart); PopUpManager.bringToFront(win);
It does indeed place the chart in the titlewindow that shows up, but it removes the original chart from the parent. Then, when the titlewindow is closed, my chart is simply gone. I can't figure out how to clone the chart -- all the methods I've tried failed
Solution:
public var barChart:BarChart; public function onClick(e:Object):void {
I have a removeChild and null question. I know removeChild removes my object from the stage but stays in memory until I call null on it. My question is, if I set the object to null, do I have to removeChild it at all? For example, I have a movieclip where I addChild lots of objects to it. So If I want to completely remove all traces of said movieclip and all its children, can I just set movieClip = null, or do I have to removeChild all its children and the movieclip itself beforehand.
Im creating a game. When the current game has finished, I thinking to do this:
removeChild(game) game = null then game = new Game()
Doing this way, it automatically removes the games object instances? It automatically removes the games object instances events? That would be an easy way to restart the game, if yes for both questions.
Can I do like that, or I have to remove all objects and events manually?
I've got these Flash students I TA for a course, and they are doing drag and drop exercises and have come across some weirdness.(They are using a frames based design to represent different pages of activity, with a menu to goto each frame under user control.)At author time:
1. they set up drag and drop as3 for an object on a particular frame.
2. when startDrag is initiated, they moved the dragged object to the top of the display list, so it appears to float above all other objects as the user drags.
at runtime,a problem appears:the object seems to have been pulled out of the frame, and now floats in a display list above any frame that may be advanced to.What's going on here? It's like the object got pulled off the authortime stage and now is disconnected. Going back to the drag and drop frame shows the original object again, reinstanced, along with this copy that got pulled out.
I have come across a variable scoping issue in Actionscript 2.0 that seems rather odd. I create a Game class that has various types of properties:
class Game { public var test_number = new Number; public var test_array = new Array;
[code]....
I can assign the numeric properties for each object just fine:
g1.test_number = 42; g2.test_number = 23;
However, when I assign values to the array property:
g1.test_array[ 0 ] = 1; g2.test_array[ 0 ] = 2;
...for some reason this will assign '2' to both of these values, even though they exist within separate Game objects! What's stranger is that they stay in their own discrete namespaces if I populate the arrays like this:
There's some custom namespaces in my Flex project, as well as the usual namespaces like "mx" and "s". I'd like to use getStyleDeclaration on a style that's in a custom namespace, and I can't seem to figure out the proper syntax.My stylesheet looks partially like this:
.WidgetTitle { fontWeight: bold; }
[code]....
If I try the same thing with a custom namespace, it outputs null:
I've tried all the combinations I can think of: "myNamespace|ScaleBar", "myNamespace.ScaleBar", "myNamespace ScaleBar" etc and I can't find any documentation on how to do this.
I have a component library. It has a manifest file that looks like this:
<?xml version="1.0"?> <componentPackage> <component id="AutoComplete" class="be.edge.components.AutoComplete" /> <!-- more components left out for brevity --> </componentPackage>
I compile the library through FlashBuilder with these compiler settings:
When I use the compiled library in other FlashBuilder projects everything works as expected. I get code completion and when I select a suggestion from the code completion a namespace attribute is automatically added to the component, like this:
I have a Flash builder project that I am migrating from SDK 4.1.0 to 4.5.1. This has been a relatively easy change (we are using maven for our builds, and were able to get a successful build after updating to the 4.5.1 dependencies).
As said, the project builds fine with maven and flexmojos. The issue is when opening the project in flash builder. The maven project is imported and then set as a flex project by running the maven flexmojos:flexbuilder build command.
The issue lies when certain mx components that are specified with the s: namespace are no longer accepted by the IDE, and result in an error. For example, for the following to compile:
This is just one example, and only happens for certain spark-namespaced components. Why is this? Why does this compile OK with Flex SDK 4.1.0 but not with Flex SDK 4.5.1, and what is the cause of the necessary namespace change?
This appeared as I was trying to use a mouseEvent to move an object.I placed the variables for mouseX and mouseY in the public class. I did the same for direction X and Y but there was no error message for those.
If you create a popup via:[code]It will create a popup and bring it on top of any other visual piece. I have one problem though. This 'popup' needs to stay up even when the user interacts with the background.I would use modal, but I need the ability to interact with the back. Any way to tell the popup manager not to remove the popup when the user clicks off of it?
I am attempting to style the headers in a flex datagrid and I keep getting the warning:
Type DataGrid in CSS selector 'DataGrid' must be qualified with a namespace
What does this mean? I have gone through a bunch of tutorials and none of them have worked. It seems like changing a the colors in a datagrid should be relatively simple.
I want it to remove everyone that it hits, but it only removes the first one that hits. I am sure the answer is simple, but i am slow. Here is the code:
ActionScript Code: function removeSpawn(){ for(j=0;j<lvl1A;j++){
I'm new here, so let's introduce myself at first: My name is Bram, I live in Holland. I am 16 years old and currently working on a little project for school. In the project you can click on stuff, and that loads an external SWF. Here is how I did that:
[Code]...
Okay. That all works, but now I want to make a button that removes the external SWF (and brings you back to the original SWF). how to do that? If you need my FLA, tell me; i'll upload it. PS: I did use search, but couldn't find anything.
I'm working on a simple Flash game for school. In one level, multiple enemies spawn and the player is supposed to shoot them. I used removeChild() to get rid of the enemy that got shot, but when I click (hit) an enemy, everything on my stage gets removed; it goes completely blank.The function to populate my stage with enemies is the following:
private function Game2():void{ for (var i:uint=0; i<50; i++) { var man:MovieClip = new man_mc();
My problem is as follows, I can create as many movie clips from on function as I wish, but as soon as I try and do two different functions - it messes up for some reason :S
Basically with my game, it is required for me to create these movieclips every so often. Because of this I created a re-usable function to do the creating:
ActionScript Code: function create_note1() { note1num++;
[Code].....
As you can see there are four different functions, and there are only 4 different movieclips that are added to the stage.
My problem is like this: I can call a single note (like create_note1();) as many times as I want without any problems, but If I try create_note1(); and create_note2(); It will remove note 1 and keep only note 2 on the screen. The problem really stumps me though, because if I called something like this: create_note1();, create_note2();, create_note4(); I may have notes 1 & 4 going down the screen and note 2 will have disappeared.
im using flash text engine to display text and i noticed it removes all whitespces at the end of a string.
e.g if i set a textblock text "a random line ", it is displayed as "a random line" but if i add a . at the end of the spaces it is displayed correctly "a random line ."
whats causing it...and how to display them correctly escape() and unescape wont change anything
I was wondering if you remove a child with "removeChild" if it removes everything what was in the movieClip.I doesn't remove listeners automatically (right?). But does it remove bitmapData (from the memory) for example? Because I don't want to remove all bitmaps with the Dispose.Does it help if I initialize the garbage collector: "System.gc();".It does help with removing listeners automatically, but what about other things?On the adobe website about the GC.But it says:For the Flash Player debugger version and AIR applications only.But does this mean that if I play the SWF outside of Flash this GC doesn't do anything?
I am loading in a swf into my file, via the loader class. When I remove this child .. does all the swf remain in the memory, or is it discarded? I want to remove it entirely ..
Code: var myLoader:Loader = new Loader(); myLoader.load("thisMovie.swf"); addChild(myLoader);[code]....
I'm trying to create a button that, when first clicked, will add a MC to the stage. Then, on the second and subsequent clicks will remove the existing MC and replace it with a new one. The code I'm using is:
public function doAddItem(itemConcepto:int):void{ modalCfd = new modalCFDItems(); modalCfd.addEventListener(Event.CLOSE, closeHandler); modalCfd.addEventListener("addItemResult", addItem_resultHandler); modalCfd.addEventListener("addItemResize", addItemResize_resultHandler); [Code] ..... Does that do it, or do I have to removeEventListener explicitly?
I have a set of 5 TextFields that a user enters info into. Each has the same TextFormat applied. If the focus is set by clicking with the mouse, the TextFormat is applied and all is well. If the focus is set by tabbing, the TextFormat is not applied and a default style for the font is seen. Here's my code:
Code: var input1:TextField = new TextField(); addChild(input1)[code]...................
ok so i have this function basically it adds text to a given position in a textfield. it adds the text in the correct position but the problem is that it is screwing with the formatting i've applied to the textfield.
here is my code:
ActionScript Code: txt.text = "hello world"; // adds text at the character index specified and returns the new string. function addText(txt:TextField, txtToAdd:String, index:Number):String{
[Code].....
i also have a function which deletes but that isn't important right now. i was trying to avoid using html text but at this point i'd willing to give virtually anything a try.
So this is my beef, I use loadMovieNum("flat/1st.swf", 20); , then in frame 50, I added unloadMovieNum(20); . The external 1st.swf disappears, but where my buttons where in 1st.swf, are still active, even though you can't see them. So how do I completely remove an external swf, without being active, even though u can't see it?