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
FlashKit > Flash Help > Flash General Help
Posted on: 11-15-2007, 09:54 PM
View Complete Forum Thread with Replies
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?
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..."
[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 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?
Loading A Movieclip On The Main Stage From A Button Within A Movieclip - Big Headache
Hi there,
i am trying to put together a portfolio site, which uses a 'floating' panel with buttons on it. In order for it to move around it has to be a movieclip. So all the buttons are stored within a single movieclip, which is giving me a headache because i want those buttons to load other movieclips from my library onto the main stage (as like a popup window within the flash)
Its all slightly confusing. i have tried using this code based within the movieclip where my button is based:
button_play.buttonMode = true;
button_play.addEventListener(MouseEvent.CLICK, OpenBox);
function OpenBox (e:MouseEvent):void{
this.addChild(new mc_box());
}
button play is within a movieclip called mcTweenMe2 (which is on the main timeline) and i want the movieclip to be loaded on the main timeline (not within in the movieclip where the button 'button_play' is based) mc_box is the movieclip i wish to load on the main timeline (in the centre) with the ability to close it also!
Bit of a headache, please help me someone i have run out of sites to look for answers!
PS: does anyone know why stop (); wont stop my timeline playing like it used to in AS2? beacause another option for making my site work is making this button target labeled frames in the main timeline, however stop (); don't seem to work now!
Thanks!
Extend Class Movieclip And Movieclip Off Stage
Hi all,
Using Flash 8 and getting over to AS2.0 I got this problem. Could not find any answer on the forum until now.
I am trying to get some more grips on AS2.0 and do this by making a small game. On several frames are movieclips: mc1 mc2 etc. When the user clicks on them, the total number of clicks is recorded (among others) for each movieclip. On different frames are different movieclips.
I tried three ways.
1. First I defined a class MyMovieClipClass extends MovieClip with:
code:
private var clicks: Number
private function onPress: Void {
clicks++;
// do other things
}
public function howMuch: Number{ // return clicks }
Movieclips mc1, mc2, etc are defined being a member of this class in ‘linkage’.
The problem arose that when on a frame without mc1 I could not access mc1.howMuch() becase in that frame there is no mc1.
2. Then I defined two classes MyMovieClipClassA and MyMovieClipClassB
The movieclip on stage mc1 is a member of Class A and var clicks is in Class B.
The instance name of class B is derivated from the instance name on stage:
mc1 (ClassA) is kindof connected with mc1_obj (ClassB)
MyMovieClipClassA extends MovieClip with:
code:
private function onPress: Void {
// make instName = this._name + “obj”;
instName.clicks++;
// do other things
}
MyMovieClipClassB with:
code:
private var clicks: Number
public function howMuch: Number{ // return clicks }
In the timeline I then define:
code:
var item1: MyMovieClipClassA = new MyMovieClipClassA();
var item1_obj: MyMovieClipClassB = new MyMovieClipClassB();
which is not very elegant.
(the movieclip to which this belongs has the name item1)
3. I tried to declare ‘_name + “_obj”’ in de constructor of ClassA but did not succeed.
Anybody any suggestions for an elegant solution in which different movieclips in different frames on stage can be tracked using classes?
Thanks in advance for your reaction.
Load Movieclip From Library Into A Movieclip On The Stage?
Alright I am losing my mind trying to figure out something so simple, I can load external swfs no problem, but How do you access a movieclip from the library?
I have a main swf, and a movieclip in the library named feb93_mov. Basically I want to on MOUSE_DOWN load the library item "feb93_mov" into swfloader_mc on the stage. But I cant write an instance name for "feb93_mov" cause it's not supported, so how do I access it then?
Here is my code what is wrong with it?:
ActionScript Code:
feb93_btn.addEventListener(MouseEvent.MOUSE_DOWN, feb93down);
function feb93down(event:MouseEvent):void
{
loadMe4();
}
var loadMe4 = function():void
{
var feb93_mov:MovieClip = new MovieClip();
swfloader_mc.addChild(feb93_mov);
}
How To Target A Movieclip Within A Movieclip On The Stage (in A Class)
Peepz,
Im building a scroll class which looks like this:
ActionScript Code:
package { import flash.display.Sprite; import flash.events.MouseEvent; import flash.events.Event; import flash.geom.Rectangle; import flash.display.DisplayObjectContainer import flash.display.MovieClip; public class ContentScroller2 { //eigen code private var moveSpeed:Number private var easingSpeed:Number private var scrollHeight:Number private var percentScrolled:Number private var newY:Number // how much of the movie can be scrolled private var scrollable:Number private var initContentPos:Number // the drag positions that are possible for the mcDragger private var left:Number private var top:Number private var right:Number private var bottom:Number private var scrollWheelSpeed:Number private var _mcContent:Sprite private var _mcMask:Sprite private var _mcDragger:Sprite private var _mcTrack:Sprite private var dragBounds:Rectangle; public function ContentScroller2(mcContent:Sprite, mcMask:Sprite, mcDragger:Sprite, mcTrack:Sprite, ease:Number, setDraggerSize:Boolean = false) { _mcContent = mcContent _mcMask = mcMask _mcDragger = mcDragger _mcTrack = mcTrack moveSpeed = 2; easingSpeed = 5; scrollHeight = _mcTrack.height ; // how much of the movie can be scrolled scrollable = Math.round(_mcContent.mcRegister.height - mcMask.height); initContentPos = 12 // the drag positions that are possible for the mcDragger left = _mcTrack.x; top = _mcTrack.y + 26; right = _mcTrack.x; bottom = _mcTrack.height - _mcDragger.height + _mcTrack.y scrollWheelSpeed = 30; dragBounds = new Rectangle(_mcDragger.x, _mcDragger.y, 0, _mcTrack.height - _mcDragger.height); initHorizontal(); } private function initHorizontal():void { // before we do anything make sure the content is even scrollable, if it isn't hide everything and return if (scrollable<0) { _mcDragger.visible = false; _mcTrack.visible = false //btnDown.enabled = false; return; _mcContent.removeEventListener(Event.ENTER_FRAME, updateContentPos); } else { addListeners(); } } private function addListeners():void { _mcDragger.addEventListener(MouseEvent.MOUSE_DOWN, draggerDown); _mcDragger.addEventListener(MouseEvent.MOUSE_UP, removeDraggerEvents); } private function draggerDown (me:MouseEvent):void { _mcDragger.startDrag(false, dragBounds); _mcDragger.addEventListener(MouseEvent.MOUSE_MOVE, draggerMouseMove); //_mcContent.addEventListener(Event.ENTER_FRAME, updateContentPos); } private function draggerMouseMove (me:MouseEvent):void { updateContentPos(); } private function removeDraggerEvents (me:MouseEvent):void { _mcContent.removeEventListener(Event.ENTER_FRAME, updateContentPos); _mcDragger.removeEventListener(MouseEvent.MOUSE_MO VE, draggerMouseMove); _mcDragger.stopDrag(); } private function updateContentPos ():void { percentScrolled = (_mcDragger.y-top)/(scrollHeight-_mcDragger.height); // instead of setting the _y property directly, we simple set newY // that way we can adjust how we handle the new Y coordinate we'd like to move to newY = Math.round(initContentPos-(percentScrolled*scrollable)); trace(percentScrolled) _mcContent.y += Math.round((newY-_mcContent.y)/easingSpeed); } }
i have a code inside my total movie which contains the scroller, the code is:
ActionScript Code:
var myContentScroller:ContentScroller2 = new ContentScroller2(mcContent, mcMask, mcDragger, mcTrack, 3, false)
All the clips like: mcContent, mcMask, mcDragger, mcTrack are on the stage.
To use this MC's well i have to (or maybe not) i have to "re-assign" them in the package like (maybe there is a cleaner and better way?):
ActionScript Code:
_mcContent = mcContent _mcMask = mcMask _mcDragger = mcDragger _mcTrack = mcTrack
but now my final question is how can i target the movieClip "mcRegister" which is inside "mcContent" on the stage? (in AS1 it was like mcContent.mcRegister but that wont work.)
the code in the package is like:
ActionScript Code:
scrollable = Math.round(_mcContent.mcRegister.height - mcMask.height);
Hope somebody can help me out!
Greetz!
Referencing A Movieclip Within A Movieclip
If I have movieclip named box01_mc inside movieclip btn01_mc and I wanted to change box01_mc's alpha to 0 on the rollover of btn01_mc how would I write this? I tried writing the following code on btn01_mc but it didn't work:
on (rollOver) {
box01_mc._alpha = 0
}
Thanks!
Referencing A Movieclip Within A Movieclip
If I have movieclip named box01_mc inside movieclip btn01_mc and I wanted to change box01_mc's alpha to 0 on the rollover of btn01_mc how would I write this? I tried writing the following code on btn01_mc but it didn't work:
on (rollOver) {
box01_mc._alpha = 0
}
Thanks!
Load Movieclip Into A Movieclip On Stage
On the loading of my page, I need to load an english text movieclip into one that's on stage. Also on stage is a button to push for the Japanese translation. When this button is pushed, I need to load the japanese movieclip into the place where the english version is and for the english to go away. How do I do this?
[f8]Loading A MovieClip From Another MovieClip In The Stage
Hi, i just learn flash and AS and now i am trying to build a menu with submenu.
I have 2 files :
a. loader.swf
b. menu.swf
Condition :
1. Loader.swf has a button that loads menu.swf into stage via createEmptyMvieClip.
2. Menu.swf have sets of button that supposed to load a jpeg/clip to Loader stage which acting as a "submenu".
And my question is :
Is it possible to load a clip from a loaded menu.swf into Loader.swf stage?
I have this code that individually works but not when i load the menu.swf. The map.swf won't load into Loader stage.
Code:
== loader.swf ==
_root.createEmptyMovieClip("menu",0);
menu.loadMovie("menu.swf");
Code:
== menu.swf ==
btn1.onPress = function () {
_root.createEmptyMovieClip("container", 1);
container.loadMovie("new_mohome/map.swf", 2);
}
btn2.onPress = function () {
_root.createEmptyMovieClip("container", 1);
container.loadMovie("new_mohome/map.swf", 2);
}
btn3.onPress = function () {
_root.createEmptyMovieClip("container", 1);
container.loadMovie("new_mohome/map.swf", 2);
}
Accessing A MovieClip On The Stage From Within Another MovieClip
Hi, after many hours searching through many forums and posts im still not finding the answer to what should be pretty simple to achive. If anyone has an idea please do tell me.
Problem is this:-
I have two movieClip's on a stage (on the main timeline). Called 'box4_mc' and 'fadeSquare_mc'. Inside 'box4_mc' on its timeline (but only on frame 54) is a button called 'close4_btn'. When I click on 'close4_btn' I want 'fadeSquare_mc.play();' to work. The actionscript code has to go on the 'box4_mc' timeline because the button doesn't exist to the main timelime. I have attached a .fla file zipped up as an example. I have tried the following:
Code:
this.parent.fadeSquare_mc.play();
and also
Code:
this.fadeSquare_mc.play();
the first gives an error 1119: Access of possibly undefined property fadeSquare_mc through a reference with static type flash.displayDisplayObjectContainer.
the 2nd gives
TypeError: Error #1010: A term is undefined and has no properties.
at boxes4a_fla::box4_12/closeBox4()
im at a loss what to do.
Thanks in advance.
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?
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?
Referencing A Random MovieClip From An Array
I know this has to be simple, but I can't solve the problem. I'm trying to call a random MovieClip from the library each time the user clicks. The MovieClip names are stored in the array. I can get a single clip to work without the array, but not with. The main problem lies, I think, in trying to apply randomStar to currStar.
The tutorial this code references is http://www.kirupa.com/developer/flas...ps_AS3_pg1.htm
Quick help? Thanks much in advance.
Code:
function Main() {
stage.addEventListener(MouseEvent.CLICK, AddStar);
}
Main();
var starArray:Array = new Array("star01", "star02", "star03", "star04", "star05");
var randomStar = starArray[Math.random() * starArray.length];
function AddStar(e:MouseEvent):void {
var currStar = new randomStar();
this.addChild(currStar);
currStar.x = mouseX;
currStar.y = mouseY;
currStar.addEventListener(Event.ENTER_FRAME, PlayStar);
}
function PlayStar(e:Event):void {
var starMC:MovieClip = MovieClip(e.target);
}
Referencing Dynamic MovieClip And Their Child
I'm having a difficult time with a simple concept due to using papervision.
What's happening is I need to create a movie clip, load an image to the clip, and then make a material with this movieclip. So this movieclip is never added to the stage, it's only created in flash's memory, to be used in the texture.
So I have this for loop (i took out the papervision guts so I don't confuse anybody):
Code:
for (var i:int=0; i < 2; i++)
{
imageLoader = new Loader();
photoTextureMovieClip = new MovieClip();
photoTextureMovieClip.name = "ptmc" + i;
trace(["ptmc"+i]+"hello");
if (i == 0){
imageLoader.load(new URLRequest("image1.jpg"));
} else {
imageLoader.load(new URLRequest("image2.jpg"));
}
imageLoader.name = "imageLoad" + i;
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, showImage);
photoTextureMovieClip.addChild(imageLoader);
Now what my problem is, is getting the name of the photoTextureMovieClip, and it's child in my event listener:
Code:
function showImage(e:Event):void{
trace(default_scene.getChildByName("ptmc0"));
var myPhoto = photoTextureMovieClip.getChildByName(e.target.loader.name);
Tweener.addTween( myPhoto, { alpha: 1, time:2, transition:"easeInOutQuart"} );
}
So the newest instance of photoTextureMovieClip tweens the myPhoto child, but I can't figure out how to get all of the instances of photoTextureMovieClip to work.
|