ActionScript 2.0 :: Child MCs In Buttons - Returns UNDEFINED
Oct 2, 2008
I'm building a play/pause button for my movie, and here's how I have it setup: The main button object is playPause_btnThe first layer of the button has a movie clip with the pause graphic, named pause_mcThe second layer of the button has a movie clip with the play graphic, called play_mcOn the button's click event, I want to set one of the graphics to 0 alpha and the other to 100 depending on the state, so only one graphic will show through The problem is, for some reason ActionScript returns UNDEFINED when I try to reference playPause_btn.play_mc -- and when I do a dump of the movie's objects, I see entries for _level0.playPause_btn.instance12 and _level0.playPause_btn.instance13 instead of the play_mc and pause_mc objects. Why aren't the objects' instance names accessible??
View 1 Replies
Similar Posts:
Aug 12, 2010
My AS3 class has some quirks. It's sort of a guestbook, so someone can add a 'question'under a certain category. When I publish the results in a dynamic textfield or when I trace the results I get the existing XML values and some undefined ones.This is my AS3 script:
Code:
//Class name is AddQuestionMenu
public function AddQuestionMenu()
[code].....
View 6 Replies
Feb 10, 2012
I am trying to get the value of a global variable from JS. The variable is defined in the HEAD section of my HTML document.
if(ExternalInterface.available){
return ExternalInterface.call("window.myVar.toString()");
}
As I debug my application this call keeps returning "undefined" but if I make the same call in firebug's console it returns a string as expected.
View 3 Replies
Nov 18, 2005
On the timeline, I set up an array with 'section' names. When the mouse is clicked, a listener traces the section name to output.
Code:
var pageName:Array = new Array();
pageName [0] = "newsHolder";
pageName [1] = "aboutHolder";
pageName [2] = "reelHolder";
pageName [3] = "printHolder";
[Code] .....
That works fine. But I also have a button on the stage:
Code:
on (release) {
trace ("testing "+pageName [0]);
}
But this returns "testing undefined".
View 5 Replies
Feb 10, 2009
I have an 3 arrarys with names, if I trace them outside a MouseEvent it works fine, but as soon as I trace it inside a MouseEvent it returns as undefined.Here is my code:
ActionScript Code:
...
gallery["imageHolder_" + i].vote_btn.addEventListener(MouseEvent.CLICK, showVote);
[code]......
View 1 Replies
Nov 10, 2004
In the following XML doc my attempt at retrieving the title attribute returns undefined, what have I missed?
[xml]
<?xml version="1.0" encoding="iso-8859-1"?>
<storyLines>[code].........
View 2 Replies
Jul 14, 2011
So, in my main mxml, i have a variable defined as such:
[Bindable] public var studentsListDict:Dictionary = new Dictionary;
I also have the following imported:
[code]...
Unfortunately, the getStudentName function simply returns undefined every time.It wasn't working b/c you can't have numbers as keys in a dictionary. Simply casting them to a string during the declaration and look up seems to work just fine.
View 2 Replies
Jun 22, 2009
I'm new here and it's been a while since I've used AS I'm trying to create a MC inside another MC
[Code]....
The code mostly comes from a tutorial I found where the demo works fine. Just my code seems to not stand up to the test
View 4 Replies
Oct 2, 2006
I have this code
[Code]...
Well i have some labels at my timeline and i pass them as an array. The problem is at the onRelease event. It returns undefined. I cant figure out how to solve it.
View 3 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
Nov 27, 2007
why doesn't this work?! first trace gives the correct coordinate, second one returns "undefined",
function create()
{
createEmptyMovieClip("holder", this.getNextHighestDepth());
holder.createEmptyMovieClip("mc_1", this.getNextHighestDepth());[code]....
View 1 Replies
Nov 4, 2011
I have a load file and a write to file method. We all know what they do. How ever load always returns true and write always returns false....Right there you know somethings wrong. Because The forums have an issue with me posting code...I posted it here: [URL] Based on this code what is the issue here? why is write always returning false and why is load always returning true? (even for files that do not exist). My understanding is that if flash cannot find the file it should write to it will create it and if it cant load said file, then that method should return false.
View 6 Replies
Aug 17, 2011
I'm trying to remove a child from the display list from a different class than I added it in but it keeps coming up that the parameter child is null. I traced it and it says undefined, but it is still on the stage.Here's what it looks like in the class where I added it:
[Code]...
View 3 Replies
Feb 17, 2011
I got an easy problem, when doing a car's game. I cannot remove a Child.The error says the property is undefined.[code]The troublesome line is removeChild(rivaleses).I need to erase that child when something happen in the gameplay ah, function crearID comes from a setInterval.
View 3 Replies
May 20, 2010
I use this pattern to test for undefined and null values in ActionScript/Flex :
if(obj) {
execute()
}
Unfortunately, a ReferenceError is always thrown when I use the pattern to test for child objects :
if(obj.child) {
execute()
}
ReferenceError: Error #1069: Property child not found on obj and there is no default value.Why does testing for child objects with if statements throw a ReferenceError?
View 3 Replies
Jul 15, 2004
I'm having with a menu navigation system. I'm using Flash MX. I have created a menu system for the site I'm building ([URL]) where one of the buttons "Choose photographer" drops down a list of names. All the other buttons just jump to another page. The drop down is currently using tweens also the logo moves to the left as the dropdown appears and returns when the dropdown returns. All working fine apart from its a bit jerky.
It's I just wanted to get away from tweening and use action scripts instead, as I'm a newbie to all things Flash I trawled the net for tutorials and examples so that I could cobble together the exact same effect. I have managed to get the drop down work and return using the action script and it does seem smoother and works slightly better. But can I get the logo to move to the left and back in time with the drop down...no.
View 1 Replies
Mar 29, 2011
public var blob:Blob = new Blob()
addChild.child(blob)
i get this error Call to a possibly undefined method child through a reference with static type Function.
View 4 Replies
Sep 24, 2010
All the actionscript is taking place outside of the timeline and in its own AS file.InProgress is a movieClip that contains nothing at start. Once loaded it contains a list of movieClips, each which contain buttons. I need to change the label on those nested buttons. The buttons are actually components, where the label is named label and its variable is labelID.[code]Now if I create just a button on the stage myself, the .label command works perfectly. However, it does not work at all with nesting... I just want to change the label of the nested resumeButton...
View 0 Replies
Apr 17, 2006
why this doesnt work.like when i click the button that calls getdepth the first two buttons work, the first time you click them but then nothing else work at all. after the first two buttons i just get undefined.
Code:
stop();
var depths:Array = new Array();
depths['1'] = 'b1';[code]....
View 3 Replies
Mar 22, 2010
I'm attaching as many instances of a MC as my xml child nodes length.So basically never know how many of them would be on the stage.Each MC receive actions to perform, nothing fancy and it basically works.But what I want to do is to know when the user has clicked once on any mc so this latter gets 'not enabled' until another MC instance gets clicked. (so my previous MC instance gets enabled, it acts like radio buttons )The point is I know how to do it when the total of instances is defined.I also know the basics of a loop , but I cannot figure how to set up a "toggle" to gets this 'radio button group behaviour
View 2 Replies
Feb 10, 2009
In my main timeline, I have an image fade in and stop on frame 61. On Frame 61, the code below executes;
Code:
stop();
var placesXML:XML =
<places>
<place name= "Bengkulu">
<frame>63</frame>
[Code] ....
There are no output errors, or compiler errors, yet when I click on one of the buttons, the movie does nothing - it certainly does not gotoAndStop on frame 62, 63, or 64 as I am asking it too. Before this code, there are no other actions at all in the movie - just a simple fade in image.. I have now tried tracing (the objects below), within the click handler curly braces (showData);
'xmlData' produces nothing in the Output
'xmlFrame' produces '0' on each click in the Output window.
Tracing both the above outside of the showData function curly braces produces;
1120: Access of undefined property of xmlFrame, or xmlData.
Tracing the nameBtn[i] produces '[object SimpleButton]' in the Output Window.
View 1 Replies
Apr 28, 2010
Basically I have 3 swf, parent.swf, child1.swf and child2.swf
parent.swf loads child1.swf
child1.swf loads child2.swf
child2.swf consists of 7 buttons which when click it will 7 different swf files.
My problem is I want to call those buttons name/instance name to my parent so that when click it will load its corresponding swf file.
View 3 Replies
Jun 15, 2009
Background: I have an Index.SWF that loads a Home.SWF. The website has essentially three layers, top layer is menu bar, middle layer is content, bottom layer is links to home page and e-mail. All the buttons on the top and bottom layers work. When I go to add a new button to the middle layer of Home.swf. I get all kind of errors associated with not referencing the right objects or having undefined objects.
I believe my structure is as follows:
> Index
>> Home
>>> Any other SWF through "myLoader" object and buttonclick function
Here's the code:
Select allvar myLoader:Loader = new Loader();
addChild(myLoader);
function buttonClick(event:MouseEvent):void{
gotoAndStop(event.target.name);
this.myLoader.load(new URLRequest(event.target.name + ".swf"));
[Code] .....
So here's the structural question, "where do I define my new button?" and what code do I use so that the new button is placed on the home page works with the myLoader and buttonclick function located in the parent page? I have the same structural question, if I decide to add a loading status message, if "the pitch" button is clicked.
View 2 Replies
Mar 30, 2010
I understand that the major difference between AS2 and AS3 is that in AS3 you have to put all your script in a separate layer, and unlike AS2 you can't add them to buttons or movie clips themselves on their respective layers.
I'm doing a project for school where I'm required to make a flash portfolio.
I have Five buttons, and right now, two of those buttons goes to a frame to display a picture. However, I've made the other buttons dynamic, and they call other swf files to show an image gallery, a game and another image viewer.
What I have a problem with is when I click the first dynamic button, and the swf if added to the parent movie clip, it does not leave the stage when another dynamic button is clicked.
So what I have is all the SWFs loaded on top of each other.
writing a code that will remove child for each button when ANY other button is clicked.
here is the code I have:
stop();
btn3.addEventListener(MouseEvent.CLICK, buttonClick);
function buttonClick(event:MouseEvent):void{
gotoAndStop(3);
[Code].....
View 2 Replies
Jul 31, 2011
I have some buttons that I have set up to drag and drop out of a pop up window in to the students timetable but when pop-up gets closed the buttons in the student timetable close with the pop-up but I would like the buttons that the child has chosen to put on the timetable to stay when the pop-up is closed! how i could actionscript them to stay when the pop-up is closed.
View 6 Replies
Mar 26, 2009
here is the scenario..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. I found this code in someone's post and I am trying to modify it so that works for multiple buttons ...it currently works for a button loading a single swf. The name of the instance name of the buttons is the same as the name of the swf file that they load so I thought I could do something that when the button is clicked it would pass the name of the button into the URLRequest but I can't figure it out. Here is the code I am using.
////////////////////////////////// code from the actions layer
var bioloader:Loader;
var biocontainer:MovieClip;
[code]......
View 2 Replies
Jul 5, 2010
I have a class that creates a navBar with some buttons. Each button loads an external .swf and everything is working just fine BUT the code is really awkward. I also wanted to use TweenLite to add transitions from section to section.I also wanted to handle the "section change" process from yet another Class (SectionChange) but whenever I try it I fail miserably. Here's what I have (including the vars), without the SectionChange Class, that's working.
private var _app:Sprite;
private var _navData:Array;
private var _loader:LoadDisplayObject;[code]....
I don't know what I'm doing wrong here but I get tons of errors with this code.
edit: Now that I'm adding the _sectionChange to the display list I only get the following error: TypeError: Error #2007: Parameter child must be non-null.
View 2 Replies
Oct 12, 2010
im having problems getting some as3 generated (not drawn on stage) movie clips moving across the screen.
Code:
package {
import flash.geom.ColorTransform;
import flash.display.MovieClip;
import fl.motion.Color;
import flash.display.*;
[code]....
View 7 Replies
Jul 12, 2007
i am using flash, .Net, and MySQL and have elements (text fields) posting in flash.Question is, if the table in the data base is not holding the var char how can I set the text field in flash to not show undefined and just be blank?
View 6 Replies
Jun 25, 2009
I have an external swf (sub.swf) that loads into my main swf. The external swf has buttons of its own...that I would like to use to load additional external swf's in its place. I click on the buttons and nothings happens.
My current code is as follows:
All of the following code is in my main.swf
================================
//Location where the external SWFs will load
var Xpos:Number=18;
var Ypos:Number=10;
[Code]...
External swf has no code except for a stop action.
I pieced this current code based on various articles I've found on the net.
View 4 Replies