See Related Forum Messages: Follow the Links Below to View Complete Thread
Referencing A MovieClip On Stage Through XML
Hello.
I have a swf with several MovieClip instances on the stage at authoring time. For example, say I have mBuilding that contains mFloor, that in turn contains mAppartment.
I have an xml file that contains data so the swf knows what to do with the MovieClips.
Code:
//xml
<my_data>
<movie_clip1>mBuilding</movie_clip1>
<movie_clip2>mBuilding.mFloor</movie_clip2>
</my_data>
//flash
//xmlMovies is the variable contaning xml data
trace (this[xmlMovies.movie_clip1]); //correct
trace (this[xmlMovies.movie_clip2]); //"... null object or reference..."
I've been trying different things, but I'm still stumped. Can anyone give me some advice?
Thanks in advance.
Referencing A MovieClip On Stage Through XML
Hello.
I have a swf with several MovieClip instances on the stage at authoring time. For example, say I have mBuilding that contains mFloor, that in turn contains mAppartment.
I have an xml file that contains data so the swf knows what to do with the MovieClips.
I've been trying different things, but I'm still stumped. Can anyone give me some advice?
Thanks in advance.
Attach Code
//xml
<my_data>
<movie_clip1>mBuilding</movie_clip1>
<movie_clip2>mBuilding.mFloor</movie_clip2>
</my_data>
//flash
//xmlMovies is the variable contaning xml data
trace (this[xmlMovies.movie_clip1]); //correct
trace (this[xmlMovies.movie_clip2]); //"... null object or reference..."
Referencing To Stage, From MovieClip
Hi i've got little trouble... First files: http://rapidshare.com/files/12813666...there.rar.html
And now. How i can get from starterClass.as file to stage, and move to frame 2?
Movieclip Referencing Another MovieClip On Stage
Hi all,
I have a movieclip with dynamically loaded content in a movieclip that sits on the stage, which works fine, it loads the content fine. Call it Clip A
I want multiple movieclips to reference this movieclips content. ie I want a copy of this Clip A to appear in multiple movieclips.
Real example
Clip A loads teamshirt Arsenal
Multiple clips to also have Arsenal teamshirt by looking at ClipA
Any ideas? Do i go about it using loadMovie and pointing it to the scene or attachMovie?
thank you in advance
Jason
[CS3] Referencing A Movieclip Inside A Movieclip From A Class File
Hello All,
I'm trying to access a movieclip inside another movie clip from a class file that is not attached to either movieclip. For instance, I'm checking hitTests for the avatar the player uses on the game, there are two enemy movieclips. Inside each enemy movieclip is another movie clip that serves as a bounding box (specifically around the mouth of the enemy so it can eat the player). Here is what I have so far that isnt working:
Code:
if (_root['otter']['obbox'].hitTest(this) && touch == false) {
trace("Otter touched Urchin");
gotoAndPlay("hit");
_root['otter'].gotoAndPlay("eat");
touch = true;
}
The class file is for the avatar. On the stage is the otter mc and inside the otter mc is another mc called obbox which is what I'm trying to hitTest against. Needless to say, it doesn't hitTest or trace or play the animation. Is there a way to reference a nested mc? Thanks in advance.
Terror.
Referencing Stage From Class
Hello,
I am trying to make my first as3 class based game and so i was wondering if i could get some help. although the game wont have fancy graphics, i just would like to understand the way it works...currently, i am at a point where im getting :
1067: Implicit coercion of a value of type flash.display:Stage to an unrelated type Stage.
in my main file robot.fla, im using
var robo:robot=new robot(stage);
//var starenemy:enemy1=new enemy1(this.stage);
addChild(robo);
inside that robot.as
....
public class robot extends Sprite {
import flash.display.Stage;
private var _stage:Stage;
....
public function robot(stageRef:Stage):void {
_stage = stageRef;
...
}
amongst other things and i cant reference anything from the stage.
I think im going nuts trying to figure out how to correctly reference things to the stage. so can you take a look and guide me and tell me how i can proceed?
Attached is the zip file
Problem Referencing The Stage
I'm having a problem that's got me completely baffled. I've got a swf file in which references to the stage give mixed results. When I test the file stand-alone, there are no errors. But when I load it from another swf, I get null object reference runtime errors. I'm referencing the stage at various points in the code, but the null errors occur only at one of those points. When I do
trace(stage)
from the code that lies outside of any function (I'm using free-form code, not a class) I get "null". But when I do the same thing from within a function, I get "[object Stage]". However, if I create a new function and reference stage from within it, I get "null". It seems to me that no matter where you reference the stage within a swf, it should always produce the same results. Am I mistaken?
Referencing Stage From A Child
Hi, I'm making a test game to flesh out my AS3 knowledge. Currently, I have a main class (let's call it gameTitle) that the game runs from. I have several other classes, including GameScreen which is eventually displayed using the addChild method. The third piece of the puzzle are the game controls. This block of code contains a method that requires 'stage' as an argument (it detects keys being held down).
This particular method works fine when it's a part of the main class. I want to move it to the GameScreen class, but I'm having trouble referencing the same 'stage' property from here without getting errors. I've tried parent.stage, but I get the following error message:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at GameScreen$iinit()
at gameTitle/menuSelection()
I should note that gameScreen is the class where the method is located. And this class is initiated by the menuSelection() method which is located in the gameTitle class.
Referencing The Stage From A Loaded Swf
I am converting my website, which has a liquid interface, to as3 but I am still learning and I have a problem.
I have child.swf that I load dynamically into parent.swf. When I run that I get:
Quote:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
Through trial and error I found that the null object is the child.swf trying to reference the stage at several places such as stage.stageWidth. If I comment all of them out it runs error free, but it also doesn't do anything. I have tried replacing the first 'stage' with other things such as 'root.stageWidth' but no dice.
I was also wonder how I can have a button in child.swf unload itself from the parent.swf?
Referencing Objects On Stage
Ok, this is a dumb question but I'm just horribly stuck.
In my script I go toframe 5, and there are several textfields and clips on stage, but I can't reference them from my code. I get an error saying the objects don't exist.
If I move the objects of stage and just move them into place later that works but I'm pretty sure there is a better way to do it.
Any thoughts or links? I've checked around google but I don't know exactly what I should be searching for here.
Help Referencing Stage Elements
How do I go about referencing an element on the stage such as a Movie Clip from within a custom class that doesn't extend the movie clip itself.
For example if I have the following document class...
Code:
package classes
{
import flash.display.MovieClip;
import classes.XMLLoader;
public class DocumentClass extends MovieClip
{
public function DocumentClass():void
{
var xml:XMLLoader = new XMLLoader();
}
}
}
and this is my XMLLoader class...
Code:
package classes
{
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class XMLLoader
{
var req:URLRequest = new URLRequest("myXML.xml");
var loader:URLLoader = new URLLoader();
public function XMLLoader():void
{
loader.addEventListener(ProgressEvent.PROGRESS, loadProgress);
loader.addEventListener(Event.COMPLETE, loadComplete);
loader.load(req);
}
private function loadProgress(event:ProgressEvent):void
{
var percent:Number = ( 100 / event.bytesTotal ) * event.bytesLoaded;
}
private function loadComplete(event:Event):void
{
var newLoader:URLLoader = URLLoader(event.target);
}
}
}
If I have a dynamic text box with the instance name xml_txt inside a movie clip with the instance name xml_movie on the stage, how can I access it from within the XMLLoader class?
Referencing Movie On The Stage Error
I have a movie_clip_A and a movie_clip_A on the stage.
From a frame in movie_clip_A and using a mouse over event, i'm trying to control movie_clip_B.
I have referenced the movie clip both relative and absolutely:
this.parent.movie_clip_B.gotoandPlay(frame);
root.movie_clip_B.gotoandPlay(frame);
But I keep getting this error. When I click go to source. It jumps to an unrelated line of code all together.
The error is:
1119: Access of possibly undefined property movie_clip_B through a reference with static type flash.displayisplayObject.
What I am not doing correctly? (By the way, i have double checked my instance names and spelling)
Referencing Stage Items From Packages
Take this very basic piece of code:
ActionScript Code:
package {
import fl.controls.Button;
import flash.display.*;
import flash.events.MouseEvent;
public class ControlButton extends MovieClip {
public function ControlButton() {
setupButtons();
trace("buttons setup");
}
private function setupButtons():void {
myPauseButt.addEventListener(MouseEvent.CLICK, pauseButtHandler);
}
private function pauseButtHandler():void {
trace("-- pauseButtHandler: pause/play clicked");
}
}
}
it just traps a button click for a button component on stage.
If you instance it in the document class, directly in the fla, it works.
Instead if you instance it in another class, defined in another package, it doesn't find the button:
1120: Access of undefined property myPauseButt.
for the record, this is how I instance ControlButton:
ActionScript Code:
var cb:ControlButton = new ControlButton();
addChild(cb); // tried with and without this, same thing.
MORALE: What should I do to see a button component on stage from some remote class?
Having A Problem Referencing Objects On Stage ?
Hi everybody,
I am having a problem referencing two objects on stage and telling them to swap depths. I have an object called "illustration" on the stage that has two separate layers inside of it. These two layers hold "illustrationText" and "illustrationTextRed". My problem comes when I try to swap the depth of the two child objects (illustrationText, illustrationTextRed).
The code I placed on the timeline:
PHP Code:
illustration.addEventListener(MouseEvent.ROLL_OVER, onIllustrationOver);
illustration.addEventListener(MouseEvent.ROLL_OUT, onIllustrationOut);
function onIllustrationOver(event:MouseEvent):void
{
root.illustration.swapChildren(illustrationText, illustrationTextRed);
}
function onIllustrationOut(event:MouseEvent):void
{
root.illustration.swapChildren(illustrationText, illustrationTextRed);
}
Compiler errors keep getting thrown:
Access of undefined property illustrationText
Access of undefined property illustrationTextRed
Am I going about this the right way?
Thanks for your help!
-Brian
Referencing Stage.stageWidth From A Class
I created a custom class in a .as file. I then linked this custom class with a symbol from the library in my .fla file. However, I can't reference stage.stageWidth in my custom class file. I get a null object error.
I think this happens because the custom class file is associated with a symbol on the stage and not the stage itself. For example, if I set the fla file's Document Class to the name of my custom class I can reference stage.stageWidth in the custom class. But I don't do this because I am creating multiple instances of the symbol on the stage. In order to do that properly i found I have to set the class in the properties panel of the symbol to the underlying class which then defines how each symbol behaves.
Under this type of linkage, is there a way to reference the stage width from the class?
I've tried root.stage.stageWidth and parent.stage.stageWidth to no avail. I also made sure to import flash.display.* in my custom class.
Below is the code for my .fla file and my .as file. In the .as file you'll see the line "x = Math.random() * stage.stageWidth;". This is the line giving me problems. I could hard code it, as I do for the y variable on the next line, but I'd prefer not to in order to keep the code flexible.
I also attached the files in a zip.
Any help would be appreciated.
ActionScript Code:
//.fla code
var i:int;
for(i=0; i < 100; i++){
var myBall:flaBall = new flaBall();
addChild(myBall);
}
//.as code
package {
import flash.display.*;
import flash.events.Event;
public class Ball extends MovieClip{
var dx:Number;
var dy:Number;
public function Ball(){
addEventListener(Event.ENTER_FRAME, onEnterFrame2);
reset();
}
private function reset(){
x = Math.random() * stage.stageWidth;
y = Math.random() * 400;
dx = Math.random() * 20 - 10;
dy = Math.random() * 20 - 10;
}
private function onEnterFrame2(event:Event):void{
move();
checkBounds();
}
private function move(){
x += dx;
y += dy;
}
private function checkBounds(){
if (x > 550 || x < 0){
dx *= -1;
}
if (y > 400 || y < 0){
dy *= -1;
}
}
}
}
Referencing Added Stage Children
I am trying to reference a child I added named "userInfo_mc" with nested inputText named "inputEmail". But I am getting this error when compiling referencing the line inside the userInfoSubmit function :
1120: Access of undefined property userInfo_mc.
Any Ideas? Any help is appreciated
Attach Code
function individualAccount():void
{
var userInfo_mc:UserInfoMC = new UserInfoMC();
addChild(userInfo_mc);
userInfo_mc.emailInput.addEventListener(MouseEvent.MOUSE_OVER, showEmailInfoBubble);
userInfo_mc.emailInput.addEventListener(MouseEvent.MOUSE_OUT, hideInfoBubble);
userInfo_mc.continue_btn.addEventListener(MouseEvent.CLICK, userInfoSubmit);
}
function userInfoSubmit(event:MouseEvent):void
{
if (userInfo_mc.emailInput.text == ""){
trace("Fill this out!");
}
}
Referencing Stage From External Class
I have an external class file that extends the MovieClip class and is linked to a movieClip on the main stage. I need it to be able to access properties of other movieclips on the main stage. How could I do this. Here is what my base movieclip class that I want to access the stage with looks like. Remember, it is linked to a movieclip on the stage, if that matters...
Obviously there is more code in the class, but I removed it for the sake of simplicity.
Attach Code
package{
import flash.display.MovieClip;
import flash.display.DisplayObject;
import Math;
public class Test extends MovieClip{
public function Test(){ //Constructor
}
}
}
Referencing Stage.stageWidth From A Class
I created a custom class in a .as file. I then linked this custom class with an symbol from the library in my .fla file. However, I can't reference stage.stageWidth in my custom class file. I get a null object error.
I think this happens because the custom class file is associated with a symbol on the stage and not the stage itself. For example, if I set the fla file's Document Class to the name of my custom class I can reference stage.stageWidth in the custom class. But I don't do this because I am creating multiple instances of the symbol on the stage. In order to do that properly i found I have to set the class in the properties panel of the symbol to the underlying class which then defines how each symbol behaves.
Under this type of linkage, is there a way to reference the stage width from the class?
I've tried root.stage.stageWidth and parent.stage.stageWidth to no avail. I also made sure to import flash.display.* in my custom class.
Any help would be appreciated.
Referencing Author Time Buttons On The Stage?
I have some buttons on the stage that were manually placed during authoring. They all have their own instance names manually assigned already. I need to code them thru my Document Class. How do I get reference to them?
I know how to do this if I am placing them from the library at runtime, but not this way.
Thanks
Referencing A Movieclip Within An Attached Movieclip
Hello,
I am trying to reference a movieclip within a movieclip that I am loading using "attachmovie". In the first frame of the root, I am attaching the movie. Then, from the attached movie I am calling a function that is also in the first frame of the root.
In the function I am tring to set the property of a clip within the attached movie to visible using the following code:
_root.logIn.loginMessage._visible = true;
I have also tried _root["logIn"].loginMessage._visible = true; with no luck.
(logIn is the name of the clip I am attaching using attachMovie and loginMessage is the clip I am trying to reference in the attached movie)
This is how I'm loading it and I know that part is working:
_root.attachMovie("login_mc","logIn",getNextHighes tDepth());
Any suggestions?
Referencing Movieclip
I need to set the width and hieght of a movie clip "pic".
I want "pic"
width = 340
height =170
Questions
1) What are my options to do this.
2) "pic" displays dynamically loaded .jpgs from a .txt file. How could I make the image enlarge to the following sizes when "pic" is pressed?
width = 460
height = 360
Referencing A MovieClip In AS
I created several Duplicate Movieclips
and I would like to reference them later to set the _visible parameter.
Obviously, the example below does not work. Any clues?
Example:
Attach Code
// for loop making several duplicates of a movieclip on a specific form ( Page )
for (var a = 0; a < 5; a++)
Page.mcLoader0.duplicateMovieClip("mcLoader" + a, a);
//for loop setting all duplicate movieclips invisible on a specific form ( Page )
for (var a = 0; a < 5; a++)
{
var mcName:MovieClip = new MovieClip("mcLoader" + a, a);
Page.mcName._visible = false;
}
Referencing What Is In A Movieclip
Hi,
I am calling an image from a server to be displayed in flash using php, mySQL. If the image is in part of a browsing gallery where there are eight images on screen all in movieclips how do I get it so when a movieclip is clicked it recognises what image it contains and then goes to another frame where it can have just that one image?
thanks
Gavin
Referencing What Is In A Movieclip
Hi,
I am calling an image from a server to be displayed in flash using php, mySQL. If the image is in part of a browsing gallery where there are eight images on screen all in movieclips how do I get it so when a movieclip is clicked it recognises what image it contains and then goes to another frame where it can have just that one image?
thanks
Gavin
Referencing A Movieclip...
I'll try again step-by-step:
Is a movieclip within a _root.movieclip still considered located at _root. level?
F8 Movieclip Change On Stage Causes The Entire Stage To Dissapear
I have my stage with a background picture.
On stage left are buttons, and on stage right I have a movieclip (mc_Preview).
When the user puts his mouse over each button I would like the movieclip to move to a different frame.
the problem is when the mouse moves over a button, i see the movieclip move but then the entire stage dissappears and turns a few shades of gray.
Does this sound familiar to anyone?
Any help would be greatly appreciated!
Referencing Movieclip Within Button
I basically want to create a button that changes appearance once it has been clicked once, rather like a hyperlink changes colour once you've visited it.
I have a generic button. Inside the button is a second layer containing a movieclip named 'visited' which has two frames, for visited and not visited. The first frame of the embedded movie clip is blank, the second changes the appearance of the button.
I create an instance of the button and call it 'button1'. Now in the actionscript I want to move the visited movieclip to the second frame if the button is pressed, in other words:
on (press) {
button1.visited.gotoAndPlay(2);
}
However, this doesn't work. I have to refer to it using an instance name like this:
button1.instance2.gotoAndPlay(2);
Obviously I don't want to do this because the instance name changes if I make changes to the movie.
My question is, how do I refer to the movieclip in the button?
Cheers,
James
Trouble Referencing In Movieclip
Hi,
I'm using flash mx and having trouble getting my buttons and event functions to work.
I have a movieclip ("TimeInputBox")that contains several buttons and an input text box.
I've put all my actionscripting on a movieclip inside the TimeInputBox movie clip. I've tried to set up my functions with:
EnterTimeBut.onRelease = function(){
trace("BUTTON WORKS!!! YAAAA!!!!!")
}
or
Selection.addListener(_parent.tbTimeSelectText);
tbTimeSelectText.onSetFocus = function() {}
This all worked when the buttons weren't inside a movieclip and were at the _root level. but now I can't get them to work.
Thanks in advance for any help,
thurston
Referencing A Movieclip In Another Scene
hello
I'm trying to quit smoking today, but for some stupid reason I just can't get this to work and now I'm puffing away like a beagle in Rothmans laboratory.
I'm trying to reference a movieclip in a different scene.
I have a function in the first frame of the first scene in my movie, it generates movieclips in the third scene and places them.
sample code
<code>
duplicateMovieClip(myButton, "myButton"+intPosition, intPosition);
//position it
setProperty("myButton"+intPosition, _y, 50+(intPosition*26));
setProperty("myButton"+intPosition, _x, -280-(intPosition*50));
strA = _root["myButton"+intPosition].getDepth();
newlogo.swapDepths("myButton"+intPosition);
strB = _root.newlogo.getDepth();
</code>
it all works fine, but when I try to reference another clip (newlogo) it doesn't seem to find it
strA is a text box that lists my buttons depth as 1
but strB says my newlogo has a depth of -16582 which seems to be a default value. If I try this
<code>
strB = _root.madeupmovieclipthatdoesntexist.getDepth();
</code>
it returns the same.
help!
Referencing MovieClip... What Am I Missing?
i've declared a temporary variable in a class method
var mc:MovieClip;
earlier the timeline the MovieClip is being created in has been declared.
but:
mc = this.timeline["face" + ID + "_" + j];
returns undefined in a trace.
what am i missing - i've tried tracing all the elements on the right hand side of the statement and it all comes out correct. timeline is '_level0' and all the rest is fine (eg face0_0) so why is this not defining mc as _level0.face0_0 ?
any ideas?
[F8] Dynamic Referencing : Getting A MovieClip To Tell Me It's Name
[AS 2.0] I've dynamically created a set of movie clip son the stage. Inside these dynamically created movie clips there is a button instance in each clip. This instance has the following code:
on(release){
trace(this._name);
}
All i get is "undefined". I'm trying to find out which movie clip was pressed.
I'm sure this is a simple thing i've just overlooked. Any ideas?
Many thanks in advance.
[F8] Referencing Dynamic Movieclip
Hi guys,
I will be greatful for some one to give me a lead on how to go about this:
I have jpg that is loaded into a single movieclip holder through an xml file, that works fine,
my problem is how do I duplicate these dynamic movieclip holder so that it loads multiple jpg's. and at the same time have control over each of these clips like tween each to x pos on stage after a set time interval,
pls any help will make a noob happy,
thanks
Properly Referencing Movieclip
so this may be a simple solution, but i am having trouble coming up with that. basically, i am creating a simple slide show that is operated by the up&down keys. each time the up key is pressed, the current slide fades out and the new fades in. however the way that i am referencing the clip i want to tween is obviously wrong, which is :
ActionScript Code:
var a = currentA+1;
contentClip = "content"+a
when i try to tween contentclip nothing happens.
ActionScript Code:
contentClip._visible = true;
contentClip.tween("_alpha", 100, 1, "easeinCubic");
is there another way that i can be doing this, is my syntax wrong, anyhelp is appreciated. fla file is attached.
david
Referencing A MovieClip Within A Button
Here's my issue:
I have a MovieClip within a Button that's within a MovieClip.
Like this:
ActionScript Code:
container_mc.myButton_btn.btnMC_mc.alpha = .2;
I receive this error:
ReferenceError: Error #1069: Property btnMC_mc not found on flash.display.SimpleButton and there is no default value.
It seems as though I'm not able to reference a MovieClip that sits within a Button. Is this correct?
Referencing A Nested Movieclip
Hi I hope someone can help me with this, The situation is that i have button in an attached movie, that needs to tell a movie clip in another attached movie, on a different level to gotoAndStop on frame 2.
this is what i was trying to use:
ActionScript Code:
on (release) {
_root.form_nav.btn_form09.gotoAndStop(2);
}
The button is located in the attached movie "form16_mc" and both movie clips (form16_mc & form_nav) are loaded onto an empty movie clip on the main stage.
"btn_form09" is a movie clip that is in "form_nav" along with "btn_form01", "btn_form02", etc.
Thank you for any help,
Eric
MovieClip Scene Referencing
So, I made a little preloader. Finally. I'll gladly share it if you want to see what Mr. Green here has done.
Anyway, there's one last snag. I may not be doing this right at all...
But here goes:
Scene 2 is a preloader. While it checks to see if scene 3 is loaded, a cute little movie clip plays and loops. Once scene 3 is loaded, some actionscript tells the little looping movie clip (in scene 2) togoAndPlay one frame past the frame that tells the movie clip to loop. This should make the movie clip finish its animation sequence.
On the last frame of the animation sequence, the actionscript says to go to Scene 3 frame 1.
But for some reason, scene 2 won't properly tell the movieclip to go to any frame. I can upload the .fla if you wish.
Thanks for any help! I really am trying.
Thanks again.
Jerry
Referencing Movieclip Problem
Code:
L1_goto = function (currentSection) {
trace(currentSection);
_root.mainNav.currentSection.gotoAndPlay("Hover");
};
L1_goto("L1_1");
I made a function which takes "currentSection" as the argument.
When I populate "currentSection" with the string "L1_1", It doesn't tell "L1_1" to play.
I think I referenced it wrong.
Haven't been doing Flash for 2 years. Pardon my noobish question.
Dynamic Movieclip Referencing
Hi,
Im trying to create a "onOver" function for my menu. Problem is i cant access a dynamic moviclip inside a dynamic movieclip.
Code:
function createMenuButtons():void
{
for (var i = 0; i < 4; i++)
{
for (var ii = 0; ii < 4; ii++)
{
(getChildByName("menuItem"+i) as MovieClip).(getChildByName("menuTextClip"+ii) as MovieClip).addEventListener(MouseEvent.MOUSE_DOWN, menuClick);
(getChildByName("menuItem"+i) as MovieClip).(getChildByName("menuTextClip"+ii) as MovieClip).addEventListener(MouseEvent.MOUSE_OVER, menuOver);
(getChildByName("menuItem"+i) as MovieClip).(getChildByName("menuTextClip"+ii) as MovieClip).addEventListener(MouseEvent.MOUSE_OUT, menuOut);
(getChildByName("menuItem"+i) as MovieClip).(getChildByName("menuTextClip"+ii) as MovieClip).useHandCursor = true;
(getChildByName("menuItem"+i) as MovieClip).(getChildByName("menuTextClip"+ii) as MovieClip).buttonMode = true;
}
}
}
function menuClick(event:Event):void
{
trace("clicked on "+event.target);
}
function menuOut(event:Event):void
{
trace("out "+event.target);
}
function menuOver(event:Event):void
{
trace("over "+event.target);
}
This will result in error Code:
TypeError: Error #1123: Filter operator not supported on type
How do i solve this?
/thanks
Referencing A Movieclip In Button...
Hello,
I am trying to control a movie clip with a button, the movieclip is located within a _root.movieclip, and the button is also located at _root. level... how is the movieclip in question referenced in the button...?
Hope it makes sense...thnx
Having Trouble Referencing A Variable Within A Movieclip
I am having trouble referencing a variable which is set within a movie clip.
I want to change the font of the text displayed in the variable.
I had recently posted a thread asking how to change fonts for variables. I got some solutions for it. I thought I will not be having trouble referencing the variable withing the movieclip........ but here I am stuck again.....
I need help with this.
In the main timeline I am having a movieclip named mesg1
this movieclip consists of a dynamic text box ---with the variable name set to msg1
I have created a button . on click of this button, the text in the variable of the movieclip should become bold.
I tried out the same thing using a dynamic text box in the same timeline as that of the button. It worked.
but when I am trying to reference the variable in the movieclip it is not making any change.
I tried to reference the movieclip like this...
/mesg1:msg1 ..... this is what is mentioned in the help of flash. movieclip:variablename
but it is not working.
The button has the code:
on (release) {
setbold("/mesg1:msg1");
}
the function setbold is place in one of the frames in the main timeline.
function setbold (myVariable) {
msg1 = "<b>"+myVariable +"</b>";
}
Can someone please help me with this
Referencing A Movieclip From An Array Element...
Hi,
I'm trying to check the current frame of a movie clip based on the content of an array element. I've tried a couple of methods but they don't seem to work.
I tried this
if (array[i]._currentframe == 3 ){}
and..
if (String(array[i])._currentframe == 3 ){}
Anyone know how I can do this?
I'm getting desperate, I need it for tomorrow...please help!
MOVIECLIP PROBLEMS: Referencing CreateEmptyMovieClip
guys,
I've got one little.. yet anoying problem here and I don't know how to get rid of it
I'm reading in an XML file that has the location of images. I've got a movieclip on stage that acts as a container (mc_container is it's name).
What I want is for each image that is read in, to be inside a new MC so that I can movie it around or change opacities later on.
- ie use createEmptyMovieClip and mc.loadMovie(image.jpg)
It's all in a loop and it looks like this:
code: ...
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
_root.mc_2D_img.createEmptyMovieClip("img"+i, _root.mc_2D_img.getNextHighestDepth());
_root.mc_2D_img.("img" +i).loadMovie(image[i]);
//trace(image[i]);
}
This obviously doesn't work - else I wouldn't be posting here. The reason is for the part that goes:
code: _root.mc_2D_img.("img"+i).loadMovie(image[i]);
Now I don't know how to properly reference the newly created MC without it causing grevious errors or simply doing nothing.
There must be a way to reference the new movieclip labeled img1, img2 etc etc.
Can anyone shed some light?
Referencing The Main Timeline From A Movieclip
So I have a movieclip on frame1 of the main time line.
Once the movieclip as finished playing I want to add a line of code that tells the playhead on the main time line to gotoandplay frame 2.
If I add
Code:
gotoAndPlay(2);
predictably the movieclip repeats itself, how do i reference the main play head. I tried
Code:
_root.gotoAndPlay(2);
but it didnt like it
Any ideas?
Many Thanks
[MX] Referencing A Dynamically Created MovieClip...
Hi,
I'm trying to load jpegs named Image1.jpg, Image2.jpg, etc, into dynamically created MovieClips using the following.
PHP Code:
TotImgs=number(myVars.TotImgs);
this.createEmptyMovieClip("ImageHolder"+TotImgs, 999);
loadMovie("Image"+TotImgs+".jpg", ["ImageHolder"+TotImgs]);
This, of course only loads one image, image3, but I just wanted to get the code correct before I start adding loops.
It ain't working but hopefully from the description of what I'm trying to achieve, somebody may be able to point me into the right direction.
The TotImgs variable loads fine, just no image loads in to the empty Movieclip.
Ta.
Referencing Variables Inside A MovieClip
Is there an easier way of referencing variables inside a movieClip, without having to add 'this.' in front of all of them
Here is my code on the main timeline, there is a clip called ball2
Code:
ball2.onEnterFrame = function() {
if (!dragging) {
_x = _x+xspeed;
_y = _y+yspeed;
if (_x+edg>r_e) {
_x = (r_e-edg);
xspeed = -xspeed*bounce;
}
if (_x-edg<l_e) {
_x = l_e+edg;
xspeed = -xspeed*bounce;
}
//ground
if ((_y+ldg)>b_e) {
_y = (b_e-ldg);
yspeed = -yspeed*bounce;
}
yspeed = yspeed*friction+gravity;
xspeed = xspeed*friction;
} else {
xspeed = (_x-oldx);
yspeed = (_y-oldy);
oldx = _x;
oldy = _y;
}
if (_x>throwArea) {
dragButt._visible = false;
} else {
dragButt._visible = true;
}
};
stop();
all variables xspeed.. etc.. are declared within the ball2 clip
Referencing MovieClip Properties From An Array
Code:
container_mc = _root.createEmptyMovieClip ("Page_Container_mc",100);
pageContent = new Array ();
for (var p=0; p<5 ; p++) {
pageContent[p] = container_mc.attachMovie ("Page Content "+p, "page_content"+p, 1000+p*100); // "Page Content 1"... are linked from library
pageContent[p]._y = 300; // won't work because ???
}
Hi all,
As you can see from the above code, I'm trying to create a set of MovieClips and save a reference to each in an Array so I can easily access them and their props/methods.
I must be having a brain-lapse because I can't get this to work. Any ideas on this or a better approach?
Any help is greatly appreciated. Cheers.
Referencing Dynamic Movieclip Names?
i can't figure this out.
here's a simplified version of what i expect:
var mcname:String = "ball";
[mcname].x += 1;
assuming ball is an mc on the stage somewhere, how can i start referencing ball via mcname?
|