ActionScript 3.0 :: Accessing Class Instances From Another Movie Clip?

Jun 2, 2009

I have a movie clip on the root which contains my menu. And another movie clip which plays my video. Basically when i click a menu item it calls a function which i want to able to send a command to my video player to play another video.

This is code inside my video player movie clip (i've missed out the including of the class and various config stuff - below is just so you see the name of the class instance)

var MDVideo:MD_VideoPlayer;
var videoPath:String = "assets/ski_video.flv";
MDVideo = new MD_VideoPlayer(videoPath, local_config_obj);

[Code]....

How do i access the MDVideo instance from my menu movie clip?

i know its probably been answered here before but I havent been able to find exactly what i need to make it work. Plus this is my first time doing AS3 so

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Accessing Movie Clip In Stage From Class

Nov 14, 2010

I have a movieclip in stage with instance name 'ts'.

I have a class Test.as

How should i refer to MovieClip 'ts' in stage from my Test class. Say for example I want 'ts' to gotoandstop at frame2.I tried root.ts but received a error.

View 4 Replies

ActionScript 3.0 :: Accessing Movie Clip In Stage From Class?

Nov 14, 2010

Iam new to actionscript 3.0. I have a movieclip in stage with instance name 'ts'.

I have a class Test.as How should i refer to MovieClip 'ts' in stage from my Test class. Say for example I want 'ts' to gotoandstop at frame2.I tried root.ts but received a error.

View 1 Replies

ActionScript 3.0 :: Accessing A Movie Clip On Stage From Class

Feb 19, 2009

I have a Flash file with Movice Clips that are placed on the stage at author time. Let's say one of the clips is called "stageClipMC".[code]Tracing "stageClipMC" return "undefined". From this class, how would I access the clip on the stage? I have tried different variations on "MovieClip(root)" and "MovieClip(stage)" to no avail.

View 2 Replies

ActionScript 3.0 :: Accessing Nested Instances From Another Class?

Feb 2, 2010

I made a movieclip (map) with nested instances (cities) in IDE and I want to access them from non-document class.

But the class can't access them until it's added at the stage too.

If I add the class at stage, class can see and access only map, but not cities inside of it.

Both class and map are children of document class...

View 0 Replies

ActionScript 3 :: Accessing All Instances Placed In Different Frames From Document Class?

Aug 11, 2011

I have programmed a game using the Flash authoring tool and a document class. I'm trying to graphically add instances and add functionality in the document class. Suppose I have a main timeline with 3 frames, each frame reperesents a different level of the game. In frame 1 I have an instance of the MovieClip class named tree1 on the stage and in frame 3 I have an instance of the MovieClip class named tree3 on the stage. In my document class, after an initial stop() command, I want some logic like:
tree3.scaleX = tree1.scaleX;
But tree3 is unknown to the runtime since we are not of frame 3 yet. Any way to access all the instances on all frames declared in the authoring tool from the document class?

View 1 Replies

ActionScript 3.0 :: Accessing Event Target And Other Class Instances?

Nov 6, 2009

I have mutliple instances on the stage of a custom ThumbNail class. As you click on a particular instance an associated enlarged external image will load. As this is happening I want to make sure that the ThumbNail class animations are inactive for all instances.

I was thinking of using a Boolean variable that would get set right before the image is loading. Using event.currentTarget should help with the instance that was clicked but how do I gain access to the instances that were not clicked?

View 0 Replies

ActionScript 3.0 :: Accessing Stage Instances From Within The Main Constructor Class?

Oct 26, 2009

my movie is linked to an external class called game, and in the game cosntructor I am trying to access instances on my stage. I have tried MovieClip(root).instancename, root.instancename and even tried adding an event listener to listen when the movie is done loading because I thought maybe it was because the instances on the stage weren't created before the constructor is ran. This is the main class, shouldn't it be easy?

View 2 Replies

ActionScript 2.0 :: Error : Frame=1: Line 5: Clip Events Are Permitted Only For Movie Clip Instances?

Jun 8, 2002

i've tried placing the code in the actions pnel of the mc; on the mc at the main time line and in various other unspeakable places... but i always get the same error warning me that this code can only be used in movieclip instances and that my stupidity levels are reaching dangerous levels. (error: 'Symbol=stage_mc, Layer=actions, Frame=1: Line 5: Clip events are permitted only for movie clip instances

onClipEvent(enterFrame){'

i fear somebody will reply to this with:'the code goes on the movieclip instance'...at which point i will take up a career in knitting (i knew i shouldn't have given up the course in the first place)

View 12 Replies

ActionScript 2.0 :: Clip Events Are Permitted Only For Movie Clip Instances?

Sep 8, 2005

clip events are permitted only for movie clip instances onClipEvent(enterFrame) {

i keep getting this output message --- can't figure out what it means.

View 1 Replies

ActionScript 3.0 :: Delete A Variable Containing A Movie Clip Class And Recreate It With A Different Movie Clip Class?

Jul 1, 2009

In my project are pages of text with each word having a button that when pressed will display a movieclip presentation about that word (its pronounciation and spelling etc..). In the project I am working on now I have over 450 unique presentations of words to deal with. I don't want to have all of these hundreds of movie clips on the stage and tell them one at a time to stop and rewind and then have one play each time a word button is pressed. That seems to be very inefficient to me.

add movieclips to the stage using addChild(movieclipname) and remove them using removeChild(movieclipname) but there is a problem. I have hundreds of unique movieclips and I don't want to have to manage hundreds of variables containing the indivudual movieclip instancess. It is a real pain having to figure out what instance is still on the stage before i delete it.In Adobe Director all I have to do is this:

View 5 Replies

ActionScript 3.0 :: Reference Instances From Movie Clips If The Movie Clip Referencing From Is Nested?

Mar 23, 2010

It's me again and I'm running into a problem. So, I have this movie clip that is nested inside multiple movie clips. I want to tell Flash to perform an action when that movie clip hits another movie clip in the main timeline. It's just collision detection for a game using the hitTestObject code. I was thinking of using MovieClip(root), but that won't work since it's nested so much.

View 15 Replies

Using Movie Clip Instances In FOR Loops?

Dec 4, 2009

if there is a way to use movie clip instances with FOR loops (yeh I'm not skilled with OOP so I premade mc's instead using loadMovie :for example I made manual SwapDepth function between movieclips, I have hero1_mc, hero2_mc,...,hero6_mc and enemy1_mc,..., enemy12_mc. The code looks something like this:

Code:

if (_root.hero1_mc._y > _root.hero2_mc._y) {
tempDepth1 = _root.hero1_mc.getDepth();
tempDepth2 = _root.hero2_mc.getDepth();[code].....

...and so on, code works fine but if I were to write all compares manually it will be thousand lines of code to check each movie clip with each other.So I was wondering is there any way to put those movie clip instances hero1_mc, hero2_mc... into FOR loop like (code doesn't work, if there could be a way to replace numbers with variables):

Code:

for (i=1; i<18; i++) {
for (j=1; j<18; j++) {
if ("_root.hero"+i+"_mc" > "_root.hero"+j+"_mc") {
.......

so I don't have to type all combinations D: so far I haven't found any way to do so, is there any way to make something similar with FOR loop and movie clips? I'm working on my project with AS2.

View 1 Replies

ActionScript 3.0 :: Movie Clip Instances And Filters?

Feb 5, 2009

I have a movie clip that is simply a rectangle with no stroke color and a fill color of red. I applied a glow filter with a green color and it glows. So far so good. I pulled another instance of the same MC and changed the instance's color to blue by changing the tint. Then I applied the green glow filter but the glow is blue and not green!

I pulled another instance of the MC and changed the instance's color to yellow by adjusting the Advanced effect from the properties of this instance. Then I applied the green glow filter but the glow is yellow and not green! Somehow when I change the instance's color through tint or advanced the glow filter does not work as expected. What is the proper way to change a MC's instance color and apply a filter to it?

View 1 Replies

Flash :: Multiple Instances Of A Movie Clip?

Sep 14, 2011

I'm creating an XML custom card game and am at the point of building the deck and making them draggable so the user can drag and drop them on top of another card.how to build the deck and put multiple instances of the movie clip that resides in the library, I just cannot figure out a way to make each one of the cards draggable. What currently is happening is the card on top of the deck is the only one that will drag, even if I click on the card below it. I have researched setChildIndex(), but I don't think I am using it correctly.

Another issue I'm having is when the user clicks the click_btn (named for testing only) to build the deck it takes a while to build it, can that be sped up any? Then once the user clicks the first card to drag it there is another long wait?

Document Class (CardGame.as)
package library
{
import flash.display.*;[code].....

The xml file actually has 64 activity card entries and 41 event card entries, but I trimmed it down to make it easier.

View 1 Replies

ActionScript 2.0 :: Different Functions For Different Instances Of Movie Clip?

May 31, 2011

I want different instances of the same movie clip to have different functions.

First movie clip:

Code:
myMovieClip.onRelease=function(){gotoAndPlay(16);}
That works!

But:

Code:
secondInstanceOfmyMovieClip_mc.onRelease=function(){gotoAndPlay(30);}
doesn't become a clickable movie clip.

Yes, I have given it the appropriate instance name. The above is the only code I have added so do I need something else to get the second bit to work?

View 4 Replies

ActionScript 3.0 :: Create Instances Of A Movie Clip?

Jul 14, 2011

For example if I wanted to do something like make a function which is used to spawn multiple instances of an enemy movie clip.[code]do this a specified number of times.How would I go about doing something like this? And what is the syntax for referring to these generated movie clips from outside of the movie clip (so i could do things like remove them, change x/y,alpha, ect, individually)I really just don't have an intuition for how movie clips actually work in actionscript, and its been holding me back a great deal.

View 1 Replies

ActionScript 2.0 :: Instances Of The Same Movie Clip On The Stage?

Aug 4, 2006

I've got a couple instances of the same movie clip on the stage. Via actionscript, I want to apply a tween to both instances. Then, when you click on the instance I want its tween to stop, but not affect the other instance. Does that make sense?

[Code]...

View 3 Replies

ActionScript 2.0 :: Swap Instances In A Movie Clip?

Apr 20, 2007

What my team is trying to do right now is build a game. It is a game where the user can build their own bike from different parts, and then test it in other challenges.

Right now I'm at the stage where they are building the bike. The first thing I'm trying to set up, is allow the user to push 3 different buttons that will change the appearance of the tires. I have the bike on a movie clip, then the tires on another movie clip within that, and then three different types of tire movie clips within that tires clip (make sense? bike>tires>3 tire clips). So I think the easiest thing would be is to somehow script each button on the root frame to just swap out the instance of the tire (the three types are: thick, aerodynamic, and trick).

View 3 Replies

ActionScript 2.0 :: Same Movie Clip - Different Instances - GetURL

Feb 11, 2010

I have a movie clip named "restlink." I drag it to frame one on layer "link," and give it an instance name of "link1." At frame 100, I create a keyframe on "link" layer, and change the instance name to "link2." In frame one of the "actions" layer, I enter the following:

[Code]...

View 5 Replies

Actionscript 2.0 :: "Clip Events Are Permitted Only For Movie Clip Instances"

Apr 28, 2009

[URL]

look at the 5th image, that is the script, when i do the publish it gives me this error "Clip events are permitted only for movie clip instances"

View 9 Replies

ActionScript 3.0 :: Adding Thousands Of Instances Of A Movie Clip?

Sep 17, 2008

I am trying to add around 20,000 instances of a single small movie clip (HexTile) from the library into a container Sprite using actionscript. The problem is it loads immediately and it loads very slowly, so I would like to know if there is a way to preload it? The class that adds the movie clip library symbol (World) is not the document class, nor is it referenced from the document class. I have tried dragging an empty sprite linked to World, and I have tried exporting it to other frames as well is preloading it as it's own .swf...

View 2 Replies

ActionScript 2.0 :: Creating Instances Of Nested Movie Clip?

Feb 12, 2009

I have a movie clip 'sliderMc' which contains two other clips 'slider' and 'groove'. I've used actionscript to make the 'slider' clip move along the 'groove' and display the value of the at each point in a text field. The idea is to have a slider object that i can use multiple times. I want a situation whereby I can create instances of 'sliderMc' so that I'll be able to move the slider on the individual clips and have each slider update different variables which would then be sent to an XML file or php. Im able tp talk back and forth between php and xml with no problem; The issue I'm facing is that after creating multiple instances of 'sliderMc', I'm not able to give the 'slider' and 'groove' movie clips different instance names without changing the instance names of all other 'slider' and 'groove' instances of 'sliderMc'. Which in turn makes it difficult to distinguish between the different sliders in actionscript.

View 0 Replies

ActionScript 3.0 :: Access Opaque Movie Clip Instances?

Sep 19, 2009

I have a flash project consisting of a single frame in the main time line. Upon user interactions many movie clips fade into the stage. My problem is that i am unable to continue working on these animations when i set the movie clips 1st frame to zero opacity. What is the correct way to access my movie clip instances when I am unable to simply double click on them?

View 1 Replies

ActionScript 3.0 :: Dynamic Movie Clip Instances Names?

Dec 6, 2009

I have the following code below which creates two movie clips on the stage dynamically. How would I give the two movie clips different instance names, so I can add separate event listeners to them?

ActionScript Code:
for (var i:uint = 0; i < 2; i++) {
var my_box:Box = new Box();

[code].....

View 9 Replies

ActionScript 3.0 :: Control Movie-Clip Instances Separately?

May 29, 2009

I have a project with two text boxes, "nameBox" and "controlBox" and a button, "createButt",I want the code to control boxes that are made in ActionScript separately, so if i put Hello into the nameBox and press createButt it will create a box with a variable attached called the playerName being the name that is entered in nameBox, when i type the name of the block into the controlBox the block will start to move, the problem is though, doing it with two blocks on the stage it will only move the block every two frames and any more will be slower, is there any way to make this code move the specified block every frame?[code]...

View 1 Replies

IDE :: Multiple Instances Of Movie Class With Same Variable Name

Sep 3, 2009

I am creating multiple instances of a movie class with the same variable name. The movie is then added random on the stage with a tween. On a mouse handler click, i want to remove the movie from the stage.

I am getting error -
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at Untitled_fla::MainTimeline/removeBlock()

Code:
import gs.TweenLite;
import flash.utils.*;
var block:block_mc;
var myTimer:Timer = new Timer(1000, 15);
myTimer.start();
[Code] .....

View 4 Replies

ActionScript 3.0 :: Create Multiple Instances Of This Movie Clip At Run Time?

Aug 3, 2010

I have created a movie clip which contains a button and a dynamic text field, instance name "anwTxt". In the dynamic text field I entered just the word "field" and set the the following in the properties window: multiline=true, wordwrap=true, font=16, font color=white.I then dynamically create multiple instances of this movie clip at run time, populating the text field from the contents of a user defined array. However if the text inserted from the array is to long it is simply cut off, instead of continuing on to a new line. Does anyone know why the field will not generate new lines, or have another solution to this issue?

Supporting info:

Code: Comments to explain
//inside a for loop[code]....

Using "holder2.anwTxt.multiline = true;" has no affect. If I attempt to alter the height or width of the textfield (ie.holder2. anwTxt. height = 400 I recieve the error "thats a read only property"

View 1 Replies

ActionScript 3.0 :: Creating Multiple, Adjustable, Instances Of A Movie Clip?

Feb 21, 2011

I've done some basic flash for my college course and i'm moving onto advanced flash and Actionscript. For this, i'm trying to build a "construction game".

What I have is objects on the right side, and I want to be able to drag out copies of those objects onto the left and have the size and rotation of each object adjustable...

So say click and drag on a circle, it puts a copy of the circle where I place it on the left. I can then drag that circle around, scale it or rotate it, or if I decide I don't want it at all, drag it onto a recycle bin icon and have it removed.

I'd like to be able to make as many copies of that circle as allowed (so maybe a limit of 10?), and have each one adjustable when you "select" it...

View 1 Replies

ActionScript 2.0 :: Dynamically Populating A Textfield Within Several Instances Of A Movie Clip?

Mar 15, 2012

been working in Flash using AS2 and loading external XML data into the movie. I am able to load the data into in Flash and parse it, but I haven't been able to figure out how to load the names of buttons from separate nod values into a textfield.Unfortunately, I dont feel I know AS3 well enough and am a little bit rusty on my AS2.I created a movie clip which holds the dynamic textfield and placed 30 instances on the stage. Each instance is successively named "cityName[i]" where i is a number from 1-30. I've tried setting the instances as both buttons and movie clips. I also tried setting both the .text and.htmlText attributes, but neither works. Ive embedded the fonts on the dynamic text field. Ive also tried changing the field to input instead of dynamic but that doesnïwork either. Ive been tracing things to try to debug, but havenï found the issue yet.Here's the code:

ActionScript Code:
//load XML data
var citiesData:XML = new XML();

[code]........

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved