ActionScript 3.0 :: Using A Child As A Button
Sep 26, 2010
1) Basically, I have my controls on the main timeline. From here, I have a movieclip. I now want to spawn a Child within this movieclip, through actionscript, that is capable of being a button. How would I do this, and how would the eventlistener look?
this.mc_1.mc_2["step"+String(i)].addEventListener(MouseEvent.CLICK, stairs, false, 0, true); Did not work.
2) Also, how can I have a button within a movieclip within a movieclip? (mc_1. links into the movieclip, but I need to link one deeper, and doing mc_1.mc_2. doesn't work)
View 4 Replies
Similar Posts:
May 10, 2010
I have a component mxml file in which i have a view stack, on click of a button i navigate to the first child, now i need to navigate to the second child during onclick of a button present in the second child. All the childs are component files included within the view stack. How could this be done, Sample code is present below,
[code]...
Now in my offering.mxml file if i try to access navigationViewStack i am getting an error stating 'Access of undefined property navigationViewStack.
View 3 Replies
Sep 1, 2009
so I have a movieclip on the stage(lets call that selection movieclip) that once a button is clicked is going to open another movieclip(call this slideshow) I am trying to remove the selection movieclip when you launch the slideshow movieclip.
[Code]...
View 14 Replies
Sep 26, 2008
I am encountering a problem with addChild and removeChild.I would like to add a child when one button is pushed and remove the same child when another button is pushed.The code I am working with doesn't work. (see attached code)and this is the error message I get back.1120: Access of undefined property gallery.
View 2 Replies
Mar 25, 2009
I have a picture on the stage that has multiple items that have hotspots/links over them that should open a child swf on top of the background and show details about the items. then have a button in the child swf itself that removes the child from over the background so the user can click on another item etc.I found this code in someone's post and I am trying to modify it so that works for multiple swf files...it currently works for a single swf.I wan to pass the name of the button in front of the .swf in the URLRequest to have the same name as the instance name of the referring button. But I can't figure it out. Here is the code I am using on the stage
View 2 Replies
Sep 28, 2009
I have a main swf that loads another swf with a close_btn. I want to be able to click the close button and unload the child swf.
PHP Code:
contact_btn.addEventListener(MouseEvent.MOUSE_DOWN, contactClick);
function contactClick(event:MouseEvent):void {
var businessMC:MovieClip = new MovieClip();
[Code].....
As of now it just says a term is undefined which leads me to believe I am targetting the button incorrectly
View 2 Replies
Nov 12, 2011
Every time i click "add new table" btn, i create new MC. Now i wish to remove any MC from stage... When i click either "Masa1", "Masa2".. and so on, then "delete table" btn, the target MC is removed.How do I do that?[code]...
View 3 Replies
Nov 6, 2010
Using AS3. I have in my code a button to stop and remove the swf, but I would like to have in addition to unload a child swf when it plays it's last frame automatically - not using a button.
Here is my code on the main timeline:
var loader:Loader;
var closer:close;
norton_btn.addEventListener(MouseEvent.CLICK, NortonDemo);
function NortonDemo(e:MouseEvent):void {
[Code] .....
Now, what do I need to add or change to this code and add to the code on the last frame of NortonDemo to accomplish what I want to do?
View 1 Replies
Oct 19, 2009
I have used AS2 for a while but the movie gets very slow when thousands of objects on the stage. I would like to turn to AS3 for better performance. My basic symbol is a MC consists of a button and a text field. Can I change it from Movie Clip to Sprite? I read a document that says "Sprites serve as containers that can be filled with shapes, images or text. "... Could someone tell me if the Sprite can also be the container for button?
View 8 Replies
May 6, 2010
I've been looking for hours on how to solve this seemingly minute problem. I've found tones of forums discusing this similar problem but for some reason I just can't get it to work. I have a flash website that uses a root.swf and each section of the web page loads a child swf onto the root. One of these sections I have a picture that loads in another child swf. We'll cal that picture.swf. This picture I want to have a button to close it and return to the previous page.
[Code]..
View 8 Replies
Mar 8, 2009
i've gone over and over this for about a week now, and no luck. here's the deal. on the top level mc called "Scene 1" i've got links to the child pages as so:
Code:
on (release) {
_root.contentHolder.myHeight = 826;
_root.contentHolder.newLoc = 10;
heightAnimation();
}
myHeight adjust the footer to drop down to fit the height of the mc
newLoc is the frame # in the contentHolder mc
these work perfectly.
my issue is i've now got a button in the contentholder mc, not the main mc, that i need to do the same two functions. since the actionscript that these call lives in the main mc i assumed i could just use _parent:
Code:
on (release) {
_parent.contentHolder.myHeight = 826;
_parent.contentHolder.newLoc = 10;
heightAnimation();
}
this does not work.
i've tried several ways to make this happen, and no luck. if the buttons on the main mc all work great and call the new page mcs, then why won't the button in the child mc work?
View 4 Replies
May 5, 2009
When roll_over button (info_btn) the child mc (infotext_1) starts and animate a text outside the button .When roll_out the child mc animate the text back to the btn.Simple, and it works... almost.[code]...
View 4 Replies
Apr 29, 2011
I am having issues trying to get a simple button to make the playhead jump to a certain frame when pressed. I have the main timeline and then have a movieclip which has buttons inside of it and actionscript applied in the movieclips timeline. Is this a no? That is should all actions go on the main timeline? If this is so then does anyone know why I keep getting an error that it can't find the instance named button inside the movieclip?
portfolioButton.addEventListener(MouseEvent.MOUSE_ DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
gotoAndPlay(100);
}
View 7 Replies
Nov 11, 2011
Every time i click "add new table" btn, i create new MC. Now i wish to remove any MC from stage... When i click either "Masa1", "Masa2".. and so on, then "delete table" btn, the target MC is removed. How do I do that?
Here is the code so far
Code:
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.TextField;
[Code].....
View 5 Replies
May 8, 2010
I'm receiving this as an output error, when trying to use a "close button" I created for a lightbox that tweens in after the user clicks all_1thumb:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at testportfolio_fla::All_mc_2/closePop().
The lightbox populates with the correct image but the close button doesn't. Here is the entire script:
import fl.transitions.Tween;import fl.transitions.easing.*;
//Portfolio SubnavArt_btn.addEventListener(MouseEvent.CLICK, goViewAll);
function goViewAll(event:MouseEvent){
(this.parent as MovieClip).gotoAndStop("Art")}
[Code] .....
View 1 Replies
Apr 16, 2011
I have a Spark ButtonBar that has a custom skin, which defines a custom skin for the "middleButton" requirement. My CustomButtonBarSkin has a custom state, minimized, which I want to pass into my middleButton skin so it can modify its design.
Is it possible to do this? I can see that my button skin could use parentDocument.currentState to get the minimized state, but that's really ugly. Any way to pass a skin from the bar to the child button(s)?
View 4 Replies
Jan 13, 2010
I have an image map with hotspots that animate when clicked and bring up info onto the stage. My problem today is how to stop the animation and remove the info on one button when a second button is clicked. The info is intended to appear in a space to the side of the image map.MY code works apart from it throws up an error when user clicks on the hotspot.[coder]I'm pretty sure that there is a more elegant way of doing this, particularly as there will be ten buttons overall.[Code].....
View 1 Replies
Mar 26, 2011
I do not want to use external .as files because I will have about 100 swfs to manage in this project, 100 swf is a lot of file management alone without adding 100 .as files on top of it.This is the code in the parent swf file to call the child swf and place it in the page_mc movieclip (note in my final project "child.swf" is replaced with the loading array variable but we're going to keep it simple):
ActionScript Code:
var pageLoader:Loader = new Loader();
page_mc.addChild(pageLoader);
var loadedpage:URLRequest=new URLRequest("child.swf");
pageLoader.load(loadedpage);
Now just for a simple function to call, we'll say we have a box_mc on the stage in the child swf, and when we click the button in the parent swf I want to call a simple function like this to hide it:
ActionScript Code:
function hideBox(event:Event):void {
box_mc.visible=false;
}
how do I call that function in the child swf from a button in the parent swf?
View 2 Replies
Mar 22, 2009
i have my Main.swf which loads external .swf inside the main window, depending on the menu chosen (so for example button one loads 1.swf, button 2 loads 2.swf, and so on). i am sure you know this type of flash page option.
i have animations running on the "children" .swf!
problem is:
when i press on the menu button (depending how long i wait) the animation on the child swf is already come to an end. if i press menu button 1 after 5 second of the main window open, it loads 1.swf already 10 seconds in. (loading time takes a few moments)..... if i press button 1 after 25 seconds, 1.swf is already stopped playing!
View 6 Replies
Apr 8, 2010
one of my problem is that how do i call the instance name of a button from my child.swf to my parent.swf
i have four buttons from my child.swf where when i click btn1 it will load superchild.swf but i want to load that superchild.swf to my parent.swf, like instead btn1 calls superchild.swf to load, btn1 will call parent.swf then on parent.swf it will distinguish that btn1 was click from child.swf and it will now load superchild.swf.
View 3 Replies
Feb 26, 2010
How do I get a button event handler to refer back to the main timeline from within it's movie clip inside another movie clip?
View 1 Replies
Nov 7, 2011
Is there an easy way to switch out a movieClip for another dynamically loaded movieClip?
I have and eventListener onCLICK that when selected it starts an FLVPlayback but I would also like to swap out with another movieClip Play Now / Now Playing button.
Just some background. I am looping and loading a play button jpg's into one movie clip and assigning an incremental number as a name to the play button movie clip. On Click that play button plays a movie but now I would also like to switch the play button graphic to a playing now graphic.
//ADD EVENT LISTENER TO ALL MY THUMBS_BUTTON
thumbs_button.addEventListener (MouseEvent.CLICK, playVideoThumb);
for (var i:Number = 0; i < my_total; i++) {
[Code].....
View 1 Replies
Dec 15, 2011
I need to access the combobox child (textinput and button) without creating a customize component. I know the best practice is to create a custom component but still need to access the combobox child like textinput and listen for their event.
View 2 Replies
Mar 20, 2011
I am going through simple tutorial that adds children of a pages upon a button click. The program runs fine but I keep getting this error when one of the buttons are clicked. The buttons were duplicated and have individual names and instance names. But one button keeps throwing the error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at Main/onLastButtonClick()
Following is the code, the library contains 3 pages named StartPage, MidPage, FinalPage and 3 Buttons called NextButton, LastButton, and ReturnButton:
HTML Code:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Main extends MovieClip {
[Code] .....
View 0 Replies
Oct 16, 2011
i successfully managed to work out the loader script, and load a external swf file into my current project. Now that its working and all is well, i realised that only way to get back to 'main menu' was to close the whole thing. I tried to sort it out with a simple 'back' button but no success there. As mentioned in the title thats the options i found so far but cant seem to quite understand them tbh. I just want it to work so that I easily can manouvre back to 'main menu'.
View 2 Replies
May 28, 2009
I have a few buttons which I need to change the state colors using AS. I am able to change the whole button color but not the state object (converted to a movie clip).
All the variables are dynamic and I have not been able to get to the child object.
var block_color = new Color("_root.c_Angola.c_1");
block_color.setRGB("0x234234");
OR
var block_color = new Color("c_1");
block_color.setRGB("0x234234");
How do I access the movie object which is in a button up state?
[URL]
View 5 Replies
Nov 3, 2009
I am creating images by loading in thumbnails and creating a bitmap of each form the press of a navigation button. However I cant seem to remove child of the previous button pressed. You can see thge example here [URL].
Code:
function loadImage():void {
var loader:Loader = new Loader();
var urlRequest:URLRequest = new URLRequest(imageURLs[loadedImages]);
loader.load(urlRequest);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
[Code] .....
View 2 Replies
Sep 11, 2010
I wanted to create a portfolio in flash, so I designed the layout in photoshop, with different webpages in different groups. So groups i created: home, about, porfolio, contact, affiliates, topbar, menu.I use Creative Suite 3 or CS3I then imported the groups into flash as movieclips, using the import to stage function. here is the image of the main scene in the flash. (SEE IMAGE 1st thumbnail)I created a new layer on top of all the layers and used labels at equal intervals to differentiate between pages.here's the image depicting the same.(SEE IMAGE 2nd thumbnail)Now in the home movie clip, i made all the text layers as movie clips to make button animations and assigned sounds and actions to them i.e. rollver, rollout andclick events. here's the swf.(PM ME FOR SWF)I want to know the code or method to load the frame labelled ''about'' in the main scene when i click on the movieclip button 'about' which is in the movieclip 'home'. Here's the code i tried for the first 'about' button, but it returns error "1120: Access of undefined property event."
code:
ActionScript Code:
var OverSound:roll_over = new roll_over();
[code].....
View 0 Replies
Apr 10, 2011
I am trying to load a swf into a holder movie clip from the child movieclip.It's parent has a holder that i want to load a swf into.I am navigating from within a child clip.It would be nice to have the swfs load from an external xml file but it isn't mandatory.
View 3 Replies
Aug 23, 2010
i have problem with swfLoader in flex, when i close following code in click method i can easly add many swf to main application
<mx:VBox id="content" width="100%" height="100%" ></mx:VBox>
public function doIT():void
{[code]....
when i close adding those swfs in loop i have the same error, it looks like child apps couldn't access certain objects that were instantiated by another child app, so what can i do?
View 1 Replies