Simple event handler for MC (AS3)


This should be easy, but I am unable to make it work. I am simply trying to start a timer when a dynamic movieclip ("mySlide") has finished playing. Here's my code:

Code: mySlide.addEventListener(Event.COMPLETE, startTimer); function startTimer(e:Event):void { trace ("timer started"); } I must be doing some simple thing wrong, as the COMPLETE event triggers nothing (whereas, ENTER_FRAME causes the trace statement to fire).

What am I doing wrong here In a nutshell, what I am trying to accomplish is to have an MC play... then hold for a determinable amount of time, then script a new function which will replace the MC with a fresh MC.

Posted On: Thursday 25th of October 2012 09:53:09 PM Total Views:  85
View Complete with Replies

RELATED TOPICS OF Flash / ActionScript PROGRAMMING LANGUAGE




2 simple problems

So I had an link in a website that was working like this... Code: Then I decided I wanted to use a Flash file instead of the picture, so I changed this to... Code: This created two problems.. 1. It moved the gallery.swf down 10 pixels from where the link.jpg was creating a gap. 2. It made my face boil over in rage because apparently you cannot simply just drop a swf in like that. What's going to be the most simple solution to this Some sort of Code: on(release) { getURL("http://www.example.com"); } or can I simply change the HTML
VIEWS ON THIS POST

99

Posted on:

Wednesday 24th October 2012
View Replies!

Trying to create a simple radiobutton

Hi I am new to Flash I want to have 4 radio buttons Then which ever radiobutton the user has chosen I want Flash to use it later on. I have found this interesting help page: http://3d4a5079.tinybucks.net/ however I receive the following errors why **Error** Scene=Scene 1, layer=action, frame=1:Line 4: The class or interface 'fl.controls.RadioButtonGroup' could not be loaded. var myradioGroup:RadioButtonGroup=new RadioButtonGroup("Group 1"); **Error** Scene=Scene 1, layer=action, frame=1:Line 13: The class or interface 'MouseEvent' could not be loaded. function showResult(event:MouseEvent):void { Total ActionScript Errors: 2 Reported Errors: 2
VIEWS ON THIS POST

91

Posted on:

Wednesday 24th October 2012
View Replies!

Hopefully simple question...

Hi , I hope this is a simple question. I am pretty new to Flash and learning as I go so please bear with me. What I am trying to do is figure out how to get to the second frame of my Flash movie after I play an external .flv using the NetStream command in the first frame. Since it has no way of knowing when the movie is done, I don't know how/when to tell it to go to the next frame... Anyone have an idea for me
VIEWS ON THIS POST

92

Posted on:

Wednesday 24th October 2012
View Replies!

CS3 Just a simple button in AS 3.0

It used to be so easy to make a button that went to a specific scene in flash. But for some reason, I can't wrap my head around the AS 3.0 code to make it. I made a button, but what is the code Say I'm on scene 1 and I want it to go to scene 3. What then Please help I'm such a noob.
VIEWS ON THIS POST

91

Posted on:

Wednesday 24th October 2012
View Replies!

Need some help with simple flash elements

there, thanks for taking time to read this post. I am a university student from the u.k and I need a little help with using flash to make a game for my main dissertation. The aim of the game is not to be fancy or challenging but simply to prove that humans can learn the fundamentals of music using a computer game and it is more effective than traditional methods. I would be looking at allowing the user to watch a 'video' or side scrolling image in accordance to the instrument being played, similar to guitar hero and the notes being played. It is my hope that allowing people to see when an instrument is being played they will find it easier to pick out and therefore will listen to music 'in more detail'. Could anyone direct me to a tutorial that would help me with this type of animation/game or at least throw me in the right direction. the fundamental parts of the game are relatively straight forward, though as I am not in a course with any game relation I am finding it extremely hard to proceed. that is required is to allow the user to select the instrument they thought was playing (by using selection boxes) and take the user onto a screen displaying which instruments they correctly identified and which they didn't.
VIEWS ON THIS POST

97

Posted on:

Wednesday 24th October 2012
View Replies!

MX04 How can I stop a simple click stopping a clip tweening?

I have got a clip that tweens across the stage into a new position. Problem I have got & this is something that I have never noticed with Flash, is that if I put an onPress() event on it & then click the clip as it moves across the stage the whole thing comes to a grinding halt! Is there anyway to stop this happening or getting the movie going again fla attached.
VIEWS ON THIS POST

192

Posted on:

Wednesday 24th October 2012
View Replies!

cs4 simple coding question

this is a project im playing with, as you can see the symbol rocks back and forth on the x-axis, how can i make it scroll left and right using the mouse but i want to limit just how far it will scroll left and right. the symbol rotates in a 3d manner using the new 3d techniques
VIEWS ON THIS POST

105

Posted on:

Wednesday 24th October 2012
View Replies!

[RESOLVED] [CS3] simple image loop not so simple

I'm relatively new to Flash - I can do some basic animations but very little actionscript. I'm looking for a tutorial to have a set of images scroll across and repeat themselves. this is what I'd like... example I can do a continuous loop of a simple background image with the 'goto' function, but I can't even find a tutorial on how to repeat individual images. Any suggestions
VIEWS ON THIS POST

210

Posted on:

Wednesday 24th October 2012
View Replies!

simple concat question

Ok I'm working in flash as3. I'm eating through video tutorials and messing around to learn as much as I can. One easy problem is making me mad because I don't understand why it won't work. I have a series of movie clips, each label mc1 through mc144. I want them to play randomly, so I have my random generator equal a variable (for now lets say it is x). Why doesn't this code play the movie clip. "mc"+x.play();
VIEWS ON THIS POST

96

Posted on:

Wednesday 24th October 2012
View Replies!

Need some simple 'gotoAndPlay' code for AS3...

Hi . Code: hqbutton.addEventListener( MouseEvent.MOUSE_UP, function(evt:MouseEvent):void { gotoAndPlay(1); trace("I've been clicked!"); } ); This is my code, and I'm using it within a movie clip called 'hqmqbuttons' and while it says the trace code 'I've been clicked!', it won't go to frame 1 in the movie. If I change the code to the name of a frame gotoAndPlay("High-Quality"); it doesn't work either. Why is it so difficult to do gotoandplay code in CS3\t
VIEWS ON THIS POST

86

Posted on:

Wednesday 24th October 2012
View Replies!

[AS3] Can't get a simple flash.display.Loader to work

This might be easy for many of you to debug. What in the world can I possibly be doing wrong! The MovieClip art Gallery is added to the stage just fine, but it's .as class can't even display a simple image 'elephant.jpg'. Please help! ActionScript Code: package { import flash.display.MovieClip; import flash.events.Event; import flash.events.MouseEvent; import flash.display.Loader; import flash.display.LoaderInfo; import flash.net.URLRequest; import flash.events.ProgressEvent; public class ArtGallery extends MovieClip { // load/set Vars var myLoader:Loader = new Loader(); public function ArtGallery() { addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); } private function onAddedToStage(event:Event):void { //Add event listeners addEventListener(Event.ENTER_FRAME, onEnterFrame); addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);\t // add eventlisteners to the property of myLoader called contentLoaderInfo myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoaderProgress); myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete); } private function onRemovedFromStage(event:Event):void { removeEventListener(Event.ENTER_FRAME, onEnterFrame); removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage); removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage); } var fileRequest:URLRequest = new URLRequest("elephant.jpg"); myLoader.load(fileRequest); public function onProgressStatus(event:ProgressEvent) { trace(event.bytesLoaded, event.bytesTotal); } public function onLoaderReady(event:Event) { addChild(myLoader); } private function onEnterFrame(event:Event):void { trace("I'M Here!"); } } } The errors: Quote: \ArtGallery.as, Line 30 1120: Access of undefined property onLoaderComplete. ArtGallery.as, Line 29 1120: Access of undefined property onLoaderProgress. ArtGallery.as, Line 42 1120: Access of undefined property fileRequest. ArtGallery.as, Line 42 1120: Access of undefined property myLoader.
VIEWS ON THIS POST

212

Posted on:

Thursday 25th October 2012
View Replies!

Model View Controller simple image load

Here I want to load an image. The arrangement produces no errors and no results.
VIEWS ON THIS POST

76

Posted on:

Thursday 25th October 2012
View Replies!

designing a simple swf player editor

... I am developing a simple swf player. I have designed interface. It will have play, pause, previous, next and mute buttons. Is there any example, any reference or any idea which I could teke advantege of
VIEWS ON THIS POST

117

Posted on:

Thursday 25th October 2012
View Replies!

Really simple: How to play a movie on stage?

I'm fairly new to action script so I think this is a basic question. I need to get a movie clip in my library to play on stage after a hit-test, then I need it to be removed after it plays. I have to hit-test working, I just need to get the mc to play and be removed.
VIEWS ON THIS POST

125

Posted on:

Thursday 25th October 2012
View Replies!

Why can't Flash do simple math?

I actually don't know any programming language that can process directly numbers with commas in it: 25,893.81
VIEWS ON THIS POST

164

Posted on:

Thursday 25th October 2012
View Replies!

simple loop question

I can't seem to get my movie clips to display evenly on the x axis.. here is what I have var mb:MovieClip; for (var i:int=0; i
VIEWS ON THIS POST

105

Posted on:

Thursday 25th October 2012
View Replies!

Converting a simple Panning script into a dynamic Class

Well I finaly found a script that's pretty easy but interesting to use. Then I thought, why not help the community out and try to convert it into a class which would be very dynamic and easy editable. Well I figured out how to draw a dynamic mask, but after that I can't seem to figure out how to implement the mouseOver/imgPanning into the same piece of code What I've got so far: PHP Code: //AS3Flafile//CodedbyMarius//InspiredbyDevelopphp.com//drawRectangle(clipName,maskXPos,maskYPos,maskWidth,maskHeight)drawRectangle(obj,50,50,300,150); And my class: PHP Code: package\t{\t\t\t\timportflash.display.*;\t\timportflash.events.*;\t\timportflash.net.*;\t\t\t\tpublicclassPanImgextendsMovieClip{\t\t\t\t\t\t\t\t\t\t\t\tpublicfunctionPanImg(){\t\t\t\t}\t\t\t\t\t\t\t\tpublicfunctiondrawRectangle(maskClip:MovieClip,maskXPos:uint,maskYPos:uint,maskWidth:uint,maskHeight:uint):void{\t\t\t\t\t\tvarbox:Shape=newShape();\t\t\t\t\t\twith(box.graphics){\t\t\t\t\t\t\t\tlineStyle(0,0x757575);\t\t\t\t\t\t\t\tbeginFill(0xFFFFFF,1);\t\t\t\t\t\t\t\tdrawRect(maskXPos,maskYPos,maskWidth,maskHeight);\t\t\t\t\t\t\t\tendFill();\t\t\t\t\t\t}\t\t\t\t\t\taddChild(box);\t\t\t\t\t\tmaskClip.mask=box;\t\t\t\t\t\t/*\t\t\t\t\t\tvarmaskW:int=maskWidth;\t\t\t\t\t\tvarmaskH:int=maskHeight;\t\t\t\t\t\tvarboundX=maskClip.x+box.x;\t\t\t\t\t\tvarboundY=maskClip.y+box.y;\t\t\t\t\t\tvardiffX:int=maskClip.width-maskW;\t\t\t\t\t\tvardiffY:int=maskClip.height-maskH;\t\t\t\t\t\tvareaseSpeed:int=3;\t\t\t\t\t\t\t\t\t\t\t\tfunctiononLoop(e:Event):void{\t\t\t\t\t\t\t\tvardivX:Number=mouseX/maskW;\t\t\t\t\t\t\t\tvardivY:Number=mouseY/maskH;\t\t\t\t\t\t\t\tvarmoveX:Number=divX*diffX;\t\t\t\t\t\t\t\tvarmoveY:Number=divY*diffY;\t\t\t\t\t\t\t\tmaskClip.x+=(boundX-moveX-maskClip.x)/easeSpeed;\t\t\t\t\t\t\t\tmaskClip.y+=(boundY-moveY-maskClip.y)/easeSpeed;\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t\tbox.addEventListener(MouseEvent.MOUSE_OVER,boxOver);\t\t\t\t\t\tbox.addEventListener(MouseEvent.MOUSE_OUT,boxOut);\t\t\t\t\t\t\t\t\t\t\t\tfunctionboxOver(e:MouseEvent):void{\t\t\t\t\t\t\t\taddEventListener(Event.ENTER_FRAME,onLoop);\t\t\t\t\t\t\t\ttrace("Over");\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t\tfunctionboxOut(e:MouseEvent):void{\t\t\t\t\t\t\t\tremoveEventListener(Event.ENTER_FRAME,onLoop);\t\t\t\t\t\t}*/\t\t\t\t\t\t\t\t\t\t}\t\t}} The commented section is the code that makes the img pan, but I cant seem to figure out how to implement this so people can still use the drawRectangle function. Thx for any and all help! MJ
VIEWS ON THIS POST

94

Posted on:

Thursday 25th October 2012
View Replies!

GC simple question

I'm adding and removing Sprites on screen but collecting names of Sprites in array Does it prevent Sprites from GC
VIEWS ON THIS POST

84

Posted on:

Thursday 25th October 2012
View Replies!

I need a simple image gallery!

all, I need a simple image gallery to load when you click a button. I've tried shadowbox but have had absolutely zero luck. I need is for a simple image gallery, nothing fancy, to open when I hit a button. Any suggestions
VIEWS ON THIS POST

124

Posted on:

Thursday 25th October 2012
View Replies!

[urgent] Need help on simple OOP [HELP]

here's a part of my code var youtubeID:String="zUFrX2pY83Q"; var Movie1:YouTube=new YouTube(youtubeID); Movie1.x = 180; Movie1.y = -225; Gallery_Bg.addChild(Movie1); how to put a "if" statement that check whether if(Gallery_Bg.contains(Movie1));\t i can't put like this "if(Gallery_Bg.contains(Movie1));" because Movie1 is not a globla variable since it needs a the "new" keywords (new YouTube(youtubeID)) for it to generate a new one everytime i open a new video... can anyone answer me how to check
VIEWS ON THIS POST

164

Posted on:

Thursday 25th October 2012
View Replies!