ActionScript 3.0 :: External Class Reads Which MovieClip Is Pressed

Sep 30, 2011

I have an external class which will add an eventListener to a bunch of movieClips. I did this this way so I dont have to write 80+ eventListeners. BUT how can Flash tell which movieClip I'm pressing?And how can I specificly let something happen for that specific instance?

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Call An OnClipEvent(enterframe) Of A Movieclip To Happen When That Movieclip Is Pressed?

Oct 24, 2007

how do you call an onClipEvent(enterframe) of a movieclip to happen when that movieclip is pressed?

[Code]...

when i type this in i get an error because on events cannot be nested within other on events. how can you get around this?

View 10 Replies

ActionScript 2.0 :: Detect The Pressed Movieclip Outof 4 Movieclip?

Jun 13, 2011

i am new to flash AS,i have 4 movieclips, those have the 4 option of a question, when i select the answer,if it correct means my score will increase otherwise it will show alert,for that first i have to press the any one movieclip out of 4 options, in AS3.0 addEventHandler will work for AS2.0 what will i use to achive this

[Code]...

in this answer1, answer2,answer3,answer4 are the movieclip for 4 options

View 1 Replies

ActionScript 3.0 :: Accessing A MovieClip From An External As That Is Not The Document Class?

May 9, 2009

Instead of posting my entire files and such, I'll make a brief example of my situation and my desired outcome. My files consist of my document class entitled Engine.as and another class Abilities.as all within the same folder. On my stage I have a MovieClip with the instance name of item1_mc. On its personal timeline I have 2 frames, one entitled "inactive" and the other "active". Here's a sample of very similar code....

[Code]...

View 4 Replies

ActionScript 3.0 :: Get Externally Loaded SWF To Act As Movieclip From External Class?

Jan 21, 2009

I have a problem - when I load a swf and I want to be able to add event listeners to propertys on it I use the code

ActionScript Code:
var headerMovie = MovieClip(loader.content);

Which works fine but what I've have created now is a class to load external SWF's and add them saving me to repeat that code, which works fine for loading the swf but as for the part where I get it to convert to MovieClip (which is what I assume that bit of code does) I'm out of Idea's.here is the class so far - the error it gives is that it cannot acces the property mloader, I've even declared it outside of the function but to no avail.

ActionScript Code:
package {
public class PreLoaderSwf3 extends MovieClip  {
var myTween:Tween;

[code]...

View 5 Replies

ActionScript 3.0 :: Handle Existing MovieClip From External Class?

Aug 6, 2009

how to addChild() a new Object to an existing movieClip on stage from an external class....

for better understanding:

This is my external Class:

ActionScript Code:
package joueur
{
public class CreeJoueur

[Code]....

Then i have the main .fla file with a movieClip on frame1 called 'terrain'.

When i try my code, the external class does'nt reach the terrain MovieClip :

ActionScript Code:
Error 1120: Access of undefined property terrain

View 4 Replies

ActionScript 3.0 :: Access MovieClip From External Class File?

Jan 19, 2009

I am currently using an external Class file for an instance in my .fla project. It creates an instance of that specific class and has it carry out some functions.I want to access a MovieClip on the stage in the .fla file in the external Class file. How can I do this?For example, the Class file creates an instance of that class, and I want the x and y coordinates of that instance to be equal to that of let's say circle_mc. Now circle_mc is on the stage of the .fla file, and therefore cannot be accessed. How can I get around this?

View 5 Replies

ActionScript 3.0 :: Accessing A MovieClip From An External File That Is Not The Document Class?

Apr 17, 2009

Instead of posting my entire files and such, I'll make a brief example of my situation and my desired outcome.My files consist of my document class entitled Engine.as and another class Abilities.as all within the same folder.On my stage I have a MovieClip with the instance name of item1_mc. On its personal timeline I have 2 frames, one entitled "inactive" and the other "active". Here's a sample of very similar code....

Code:
package
{
import flash.display.MovieClip;

[code]....

How do I access item1_mc? In reality I have 6 different clips and I desire to access much more than frame changes...what's the overall best way to be able to interact with an item placed on the stage via an external .as file that is not the document class?

View 11 Replies

ActionScript 3.0 :: External XML Images Display Into MovieClip Using Loader Class?

Jun 19, 2010

I am trying to load images from external XML files, and display on a movieClip name thumb_mc, The following codes will generates a list of buttons using button_mc, my task here is to add a thumbnails to each button from each record of xml.I have added below codes in red, However, what I am getting is the thumbnails are overlapping each other. What should I do to make it display on the thumb_mc on each button?

Code:
public function showXML(e:Event):void {
XML.ignoreWhitespace = true;
xml = new XML(e.target.data);//loading the xml[code]....

View 1 Replies

ActionScript 3.0 :: Removing Dynamically Generated MovieClip In External Class?

Apr 3, 2009

I have problem with removing dynamicly generated MovieClip in external class. How can I remove it? I'm getting this error:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.at flash.display::DisplayObjectContainer/removeChild() at SomeEffect/updateMc()

View 1 Replies

ActionScript 3.0 :: Dynamically Creating MovieClip From Library With External Class

Jun 10, 2010

I am making a Thumbnail class which is part of my Photo Gallery Package that I am building with the intent of automatically generating my thumbnails. I do not want to limit myself to just AS3 animations, I would also like the ability to use timeline animations. I have a system using "in" and "out" for frame labels which I find very efficient and I get stuff done quickly. So I created the thumbnails holder MovieClip with the animations and have it linked in my Library, however, when I try to pass it to my Thumbnail Class, I only get one instance and I need to create several instances.

Document Class
ActionScript Code:
var thumbCont:mcThumb = new mcThumb();
thumbNails = new Thumbnails(thumbCont);

Thumbnails Class
ActionScript Code:
var thumbContainer:MovieClip;
public function Thumbnails(thumbCont:MovieClip,) {
thumbContainer = thumbCont;
}private function createThumbs():void {
for (var i:int = 0; i < aThumbs.length; i++) {
[Code] .....

I eliminated most of the additional stuff. What this does is that it doesn't create several thumbContainers, rather it just uses the one. So how would I be able to generate several of them? I can obviously create an Array with them and create them in my document class, but if I can avoid that and have my thumbnail class do it by itself, that would be perfect.

View 2 Replies

ActionScript 3.0 :: Passing A MovieClip Reference To A Function In An External Class?

Mar 25, 2010

I want to create a MovieClip, pass this MovieClip to a function in another class where it will be modified.The problem is, when I pass the MovieClip as a parameter to a function and start making changes, the changes are only made locally. The "copy" of the MovieClip inside the function gets changed, but the "real" MovieClip back in my main game class remains unchanged. Here's the code from my Main class:

Code:
var resourceLoader:ExternalResourceLoader = new ExternalResourceLoader();
var myMovieClip:MovieClip;[code].....

View 4 Replies

ActionScript 3.0 :: Reference Movieclip Instance On Stage From External Class File?

Nov 21, 2010

I've been searching around all afternoon, and am pulling my hair out. 1) I have a movieclip instance on stage (simple graphical element that represents platforms for a hero to run and jump along). I have placed it on the stage with an external class engine.as and in this class it is called myPlatform and is an object of Platforms.as. The movieClip is called platforms and from a trace(myPlatform.name) the instance name is instance3.

2) I am attempting to access the properties of myPlatform in an Enterframe event loop in my character control and collision class (called hero.as)

Basically here is the bit of code I am trying implement within Hero.as :

[Code]...

This all worked when I was writing actionscipt within the FLA file, on the timeline frame 1. I simply don't know how to access myPlatform from within the external Hero.as class! Do I need to create a variable? Is there a really easy way to do this with some syntax/command that I have not learned yet?

View 3 Replies

ActionScript 2.0 :: Load An External Movie When This Button Is Pressed?

Apr 26, 2009

I have a button with an instance name of sound_btn. I'd like to load an external movie when this button is pressed, and then make this movie slide from "out of the canvas" into the canvas.My problem is how to deal with an external movie...

Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var revealTween:Tween;

[code]....

View 3 Replies

ActionScript 3.0 :: OMG - Get A Button When Pressed To Display Text From An External .txt File

Oct 29, 2010

Im trying to get a button when pressed to display text from an external .txt file (which I've done so far), but (1) I want it to only display certain paragraphs (the actual dialogue) of this text and (2) every time I click the button it should replace the old text with the new (like in any RPG). Now I asked a former lecturer for help and he gave me a link to a website and gave me a hint of what to do, but seeing as I was recently voted #48 on Forbes worst 100 programmers of all time (actually I haven used AS for 5 years) so I thought someone could explain it to me in a much clearer fashion? PS: My lecturer said: When you click the button to add text to the textfield but you ewant the previous text to be cleared the first thing you do is empty the box ( myText.text = "") then fill the box again with your new text..

[Code]...

View 3 Replies

ActionScript 2.0 :: Getting The Pressed Movieclip In An Array?

Nov 18, 2003

I've got an problem with reading out an array, the array is filled with movieclips with each an different picture in it (php variable -an url). Basically what i want to do is get the pressed movieclip and use another method to change the _xscale and _yscale properties of the pressed movieclip (an picture) and then pass it back to the function brillenArray.onEnterFrame to change the values of that movieclip!

Only thing what i now get is that either all of the pictures move or none...

[AS]
brillenArray = new Array();
for (var i = 0; i<5; i++) {
if (this['plaatje'+i] != undefined) {

[Code].....

If i press one of the four pictures it does what i want to: THAT picture scales to 70. But how can i call this movieclip (the pressed one) from another method without using specified place in the array (like brillenArray[1])?

View 2 Replies

ActionScript 1/2 :: Make A Movieclip Play Only While A Key Is Pressed?

Mar 21, 2012

this is the code i am using, i get what flash is doing, after i release the key it starts to play the "walking" frames- only i include the gotoAndStop("idle") so it doesn't get to play "walking".but what i am looking for it to do is play the  walking only when the key is pressed and stop when released.

onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT))//68
{
this._x += moveSpeed;
this.legs.gotoAndPlay("walking");

[code]....

View 1 Replies

ActionScript 3.0 :: AddListener Firing When Pressed On Another Movieclip

Jan 3, 2011

I had an odd occurance where a listener was firing when I pressed on another movieclip. Both functions executed, which obviously caused some trouble. I fixed the misfiring listener by creating a new child (panel) and then adding the listener's movieclip to panel.

View 3 Replies

ActionScript 2.0 :: Fading Out MovieClip When Button Pressed

Jul 2, 2004

on (release){
_root.drew._visible =false;
gotoAndPlay(31);
}
Above is my code which I am using to try and fade out a MC when a button is pressed. The button (and the picture it shows when pressed) are within the same MC. I have placed this MC on the root timeline and given the MC I want to fade out the instance name drew // but still not having any luck making invisible.

View 4 Replies

ActionScript 2.0 :: Make A Box That Fades In When Pressed On The Button And Fade Out When Pressed For The Second Time?

Nov 16, 2004

I have a function on root:

_root.fadeBox_mc.onEnterFrame = function (){
if (fade){
this.nextFrame();[code]....

This causes a mc to fade in and out on rollover/rollout. But what I wanna make is a box that fades in when pressed on the button and fade out when pressed for the second time. But if I say

on (press){
_root.fade = true;
}

the mc fades in, but I cant do another on (press) to fade out. Is this too confusing?

View 2 Replies

ActionScript 3.0 :: Using An External Class To Reference Functions From Another External Class?

Mar 25, 2010

I have a Main.fla which loads Main.as as its document class. In Main.as I have a public function named "Main" which runs a trace. I also have another .as file called Preloader.as, which also has a public function in it, this one named "Preloader" with simple trace in it. I just cannot figure out how to use Preloader() from the Preloader class in Main() from the Main class. Main.as loads up fine when the SWF loads and traces.

View 10 Replies

ActionScript 2.0 :: MovieClip Resize Animation When Button Pressed

Mar 17, 2004

{URL] Here I have a movieclip that I want the clip size to change when pressed a button, and change into another size when another button is pressed. but all these, with actionscript movement. How do I...? Here is the fla: [URL]

View 3 Replies

ActionScript 2.0 :: Unload A Movieclip When It's Pressed And Load Another One In Its Place?

Jan 19, 2008

I'm trying to unload a movieclip when it's pressed and load another one in its place. For some reason the loaded movieclip is always being loaded at row 7 column 10.

Code:
var columns:Number = 10;
var rows:Number = 7;
for (i=0; i<rows; i++) {
for (j=0; j<columns; j++) {

[code]....

View 1 Replies

ActionScript 2.0 :: AttachMovie - Loading MovieClip When Button Pressed

Apr 11, 2008

Adobe Flash CS3
publishing as Flash 8, AS 2.0
I have a movieclip named menu (instance name = mainmenu). Inside of that there is a button named btn_about (instance name = about). On the main stage there is an empty movieclip named empty_mc (instance name = mcholder, linkage id = empty). I want a user to press the button which causes a movieclip in the library named tesst (Linkage name = testid) to load into the empty movieclip (mc_holder).

Here is the code on the button:
on (release) {
this._parent.mcholder.attachMovie("testid", "tesst1", this.getNextHighestDepth());
}
It does not work.

View 2 Replies

ActionScript 2.0 :: Changing MovieClip Scale When Button Pressed

Jun 12, 2002

Is there any possibility to combine those two handlers. I want a movieclip changing its scale when a button is pressed. The change I would write as this:
onClipEvent(enterFrame) {
if (_scale<200) {
_scale+=10;
}}

But I can't write
on (release) {
onClipEvent(enterFrame) {
...
Is there a way to realize it?

View 4 Replies

ActionScript 3.0 :: MovieClip Change Animation Depending On Key Pressed

Jul 26, 2009

I have started to make an interactive movie where pushing keys moves a movie clip around the stage! And I can obviously make the movie clip do what I want, so here is the question: I want to make the movie clip change its animation depending on which keys are being pushed i.e. Left key the movie clips moves left, and my stick man changes to a running animation. Push nothing and it changes back to his standing still animation.

View 2 Replies

ActionScript 3.0 :: When A Button Is Pressed It Adds Another Movieclip (from The Library)?

Jan 14, 2012

When a button is pressed it adds another movieclip (from the library) to a movieclip acting as a container at the bottom of the screen. This all works fine, and the movieclip is added to the container (directly in the middle), what i need is it to be positioned to the left. Obviously i could change the .x value, but its a little bit more complicated, because if there is already one movieclip there (in the container at the bottom), the next one that is added needs to be 25 pixels to the right of the movieclip already there.

Code:
var bass1:Bass1 = new Bass1();
//navigation
help_bt.addEventListener(MouseEvent.MOUSE_UP,help);[code].....

View 14 Replies

ActionScript 2.0 :: Call The Function PressMc When Movieclip MyMC_mc Is Pressed ?

Nov 11, 2005

In the following code I am trying to call the function pressMc when movieclip myMC_mc is pressed and the apply the drag action to it. However the drag action is being applied to the whole of level0 and therefore all of the moviclips.I am not sure why. Am using the this key word as I would expect this to be identified as myMC_mc when the myMC_mc.onPress is evoked.I want to write this as a function because I want to apply this drag action to lots of different movieclips

function pressMc (){
delete this.oldX;
delete this.oldY;[code]....

View 5 Replies

AS3 :: Reads A String From A XML?

Feb 11, 2010

The AS3 reads a string from a XML, that string contains a "" for a line break, but it dosen't work. The "" is displayed as part of the text.How can I include the break line in the XML?

View 2 Replies

Trace A Text If The Mouse Is Pressed (MouseDown) And Is It's On A Movieclip (DragOver,RollOver)?

Apr 5, 2009

I want to trace a text if the mouse is pressed (MouseDown) and is it's on a movieclip (DragOver,RollOver)...can't manage to put all the 3 condition allong for the script to work...

View 1 Replies







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