ActionScript 3.0 :: Adding Buttons Via Display List Breaks This Function?
Jan 31, 2012
I'm trying to add the btns in array "but" via stageMc.addChild(section1), but instead of tracing "section1" I get "instance1", and of course stageMc wont advance. I guess what I'm asking, is whats the diff. from a functional standpoint if I embed the clips in flash, or embed them into the stageMc clip via the display list? what am I missing? FYI, this code works, so long as i place the assets on stage myself. But I want to add the btns via the display list, and i can add them, they just instanciate wrong?
What i'm trying to do is create an errorAlert class. The role of this class is to as you might expect display an alert:) So the current class is set up in such a way.
1. pass in an errorcode returned from the server into the constructor.
2. This runs through a switch and sets a msg variable to the right textual prompt based on the code. At this stage it also sets an alert type, so as an example it could be a severe alert where the user has no option other than ot refresh the browser. Or it is a softer alert where the user is able to press a close button and proceed.
Because all of the type handling and everything is held within the class. I want to avoid adding the instance to the display list within the main document class. Ideally just letting the class add itself to the stage AND IF it is a softer alert, it can show the close button, add an event listener, and, then remove itself.
I load an png image and add it to the display list. Now I want to add this image more than once, like a pinball game there could be 3,4,5 balls, all with the same image. But I cant add the same image reference more than once to the display list, right? So should I make a copy of it? How can I copy it and add to the display list without needing to load it from file more than once?
I have a single image I imported to the library of an Fla document. I could have easily imported it to the stage, but I chose the library instead. It is a .png file. It's name is ace_clubs.png. On import a symbol was created by Flash and I deleted it. THE ONLY THING IN THE LIBRARY IS ace_clubs.png . I then right clicked on the the image and filled in for properties the following:
1. Export for ActionScript
2. Export in Frame 1
3. The class was by default named ace_clubs.png which I renamed to my_images .
4. The base class by auto default is flash.display.BitmapData
So how do you get the image (ace_clubs.png) to display in the Flash movie at say (0,0) ? Meaning in the ActionScript window what code is needed?
I have an embedded image asset (with a scale9 grid), and I'm trying to get the bitmapdata when it's resized, but I can't seem to do this without adding it to the display list.
why I cant kill a child in my display list. So I'm working on an ad that is going to load in different swfs depending on the link you click. What I wanted to happen is when the ad loads the first swf is auto loaded in to my container. Then when you click on the next link the new swf would cancel out the last one. What I am getting is an overlap of the swfs and I understand that. I can't figure out how to kill the other children. I tried unload and remove child but have been unsuccessful.
I'd like to remove a child of the display list if it exists before adding another to the stage. This gives me Error the first time I call it because 'myMC' doesn't exist.
HTML Code: function callMc(){ if(myMc) removeChild(myMc);
I am trying to add multiple different versions of the same button to the stage and to be able to access them later on by assigning them an ID. The way I assumed this would be done is to have a class for the button where an internal static variable is defined so that the ID can be found in the next function. This does not seem to be working, as the ID is constantly showing as the last number given, so in this case 6.I assume that I am doing this wrong? Here is my code so you can better understand:
I want to add a SimpleButton to a list item in a list component. I am getting the CellRenderer for the list item I want and using the addChild method to add the simple button. The button appears in the right spot on the list item but it doesn't function like a button. It's like the contents of the buttons first frame is added to the CellRenderer and nothing else.
For some reason, when I import my external html to my page, I'm getting extra line breaks. Even if I don't use a <br> in the line, but do a hard return, I'm getting a line break. So that's weird too. As well, it doesn't do the bold (which may be an embedding issue, as I'm using a nonstandard font. I've got the normal font embedded. of coruse, the italics works, which is weird.). What am I doing wrong?I don't think it does anything, but I've set the textbox to "render as HTML," if that effects anything.
My AS code: ActionScript Code: dynamic_txt.visible = false;
Using Flash Pro CS4/Windows Vista: I have a table layout which breaks apart in Firefox leaving gaps between cells after inserting a SWF file.
I have inserted the file using the Insert>Media>SWF command in Dreamweaver and uploaded the SCRIPTS folder.
When I remove the SWF object, the file displays perfectly (with an empty cell where the SWF object should appear) The SWFobject is 2 pixels narrower than the containing cell (cell: 227w X 146h; SWF 225w X 146h)[URL]..
I have this slideshow type of thing I'm putting together with next and back buttons. Everything works fine until I add audio to the timeline and then all my nav buttons flake out. I don't want to load these files externally or from the library because they are voiceover narration with all my animation synced up with what is being said.
I have a sample zip attached so you can see what I am trying to do. Basically I have a banner with 3 slides. Each slide is also a clickable link. Each slide pauses for 5 seconds. All of that works fine when you just let it loop. I also have 3 buttons at the bottom so you can jump around to different slides. Problem is that when those buttons are used the slides no longer pause for 5 seconds. They all become erratic. They may pause for one second each or more. If you open the flash file you can see it cycle 5 sec at first but if you use the 1 2 3 at the bottom it no longer works correctly. I have been trying to get this worked out all day. Here is the code for each slide
Slide 1 ActionScript Code: stop(); import flash.events.MouseEvent; this.stop(); var timelinePause:Timer = new Timer(5000); timelinePause.addEventListener(TimerEvent.TIMER, timerHandler); timelinePause.start(); function timerHandler(evt:Object):void { [Code] .....
I have a list containing display objects from throughout the application (insertion order). I want to process the list either top-down (parent, child) or bottom up (child, parent). The only requirement is that either a parent is processed before any child or vice versa a child before its parent. What is a good approach? This question is not about sorting a list. It's about retrieving the depth of a particular display object.
Example Display list: A (root) B1 C1 C2 D1 B2 ......
My list: list = [E1, F4, A, B2, B1, C3, ..., N9, N8]
Bottom-up: N9, N8, F4, E1, C3, B2, B1, A
Top-down: A, B2, B1, C3, E1, F4, N9, N8 Does not matter if N9 before N8 or N8 before N9. Important is that any N is before M (first run) or any M before its children N* (second run).
How do I identify all the display objects in the display list in ActionScript, bellow the one that I have clicked? All the other objects are shadowed by the first one. What if other objects have visible parameter as hidden?
It's my understanding that a display object cannot be in the display list more that once.So if I add something to the stage shouldn't a second addition of the same object replace the first? for instance:
[code]...
there should now only be one "myDisplayObject" on the stage.
I am attempting to have the main timeline move from a stopped position over a movie clip to frame 1, where my start menu is.The code I'm using does move the timeline but in doing so it somehow breaks the 4 buttons I have in frame 1.
My code in the movie clip: stop() function replayMovie(event:MouseEvent):void
I'm attempting to add line breaks after the code I've included below. I know that I need to add a " " after the line of text, but I haven't had any success.
i am using: ActionScript Code: vidList.addItem({Label: " first path showing ", data: "../myflash/vid/path1.flv"}); The list and buttons work, the videos play - however my labels are not showing on the buttons even though i have added a label to each video as shown above...
I tried to add some thumbnails attributes to list component,i was using the xml vidlist however i was unsuccesfull.i thought just adding another attribute would work but it didnt .am i suppose to make an image holder i am sorta lost at this point
I have a list of flvs that are selectable with buttons and I would like to add cue points to the individual videos to trigger other events and I'm afraid my skills are lacking here.How do I target an flv in a list to add cue points and how do I target these cue points to trigger movie clips?
when I add items nothing appears in the component but when I make a second adding cycle List shows the one I added previously...The code with which I add my elements is this.The studied method is updateStorages(), the rest is to understand how's the process cycle.All the trace you see in the code works with no problem.
ActionScript Code: public function Scopa() //constructor { [...]
I'm having alot of trouble tracking down the name of an object on the display list so i can removeChild Is there a way to trace every object on the display list so i can get its name and remove it? my stage is changing dynmically and i can't jut trace each object through a whole whack of code.