Easy code to frame problem


well i have some multiple choice questions on frame 7 then it continues onto frame 8 and on there i have a dynamic text field which shows how much you have scored. the problem is .on frame 8 i have all the code which gives the number in the text field if you get it right however when i code it into the event listener on frame 7 your score does not come up on frame 8. i know i havent explained it well but could someone help me i need to give this in tommorow.
Posted On: Thursday 3rd of January 2013 10:22:11 PM Total Views:  306
View Complete with Replies

RELATED TOPICS OF Flash / ActionScript PROGRAMMING LANGUAGE




Dim txt easy method needed.

I have a user interface with typical controls, stepper checkbox, etc. On occasion I want the controls disabled, eg ctrl.enabled = false; However I want certain accompanying black text to be dimmed out at the same time. Is there an easy method that I'm overlooking or must I for example create my own base class and use color.transform, or similar. TIA
VIEWS ON THIS POST

256

Posted on:

Thursday 25th October 2012
View Replies!

1119: Access of possibly undefined property (easy to fix) Really need help :(

and gals, just wondering if anyone can help with this problem. I think it will be extremely easy for most of you, I really need help tho as I am a noob to as3 My code is as follows Code: buttons_mc.vespabutton1_btn.addEventListener(MouseEvent.CLICK,vespabutton1Click); function vespabutton1Click(e:MouseEvent):void { trace("click1"); root.vespaArray_mc.x = 175; root.vespaArray_mc.y = -51; } buttons_mc.vespabutton2_btn.addEventListener(MouseEvent.CLICK,vespabutton2Click); function vespabutton2Click(e:MouseEvent):void { trace("click2"); root.vespaArray_mc.x = -759; root.vespaArray_mc.y = -51; } and the error i get is as follows: 1119: Access of possibly undefined property vespaArray_mc through a reference with static type flash.displayisplayObject. I have attached my working file, maybe useful
VIEWS ON THIS POST

221

Posted on:

Thursday 25th October 2012
View Replies!

easyLoader,be more stronger,more simple!load all types of files in one way!

!Very happy to announce to the world,my easyLoader project was updated to 1.012. this class can be used to load sound,video,txt,xml,image,swf,event dae and on.and you can add custom file type for easyLoader. author :liuyi email:ourbrander@gmail.com, Home and document online!:http://www.ourbrander.com/easyloader/ Google code:https://code.google.com/p/easyloader/ What is easyLoader This work is use load all the assets of website or game,it is an good assets manager. People can use it to load sound,video,txt,xml,image,swf,dae and any custom types of files. Why we need it -easy of use Every method have a good naming,you can use it likes speak to an friend.Only need several lines to complete the work. -never be lost items load items one by one. -excellent memory manage Using it continually more than 24 hours,memory do not increase without limit.item can be destoried,easyLoader Object(include all assets) too. -flexible User can add custom file type to loading. -dynamic add items for easyLoader EasyLoader can add and load new assets anytime and anywhere,although all the items were loaded. -Updates will updates according to user's requirements. How to use Realy only need several lines: step1: new a easyLoader Object line1: var _assetsManager = new EasyLoader(); step2: add some necessary event Listener line2: _assetsManager.addEventListener(EasyLoaderEvent.CO MPLETED,assetsLoaded) step3:add the assetsLoaded function line2:private function assetsLoaded(e:EasyLoaderEvent) { line3: //put some code to here like init() line4:} step4:load assets according to config xml line5:_assetsManager.loadConfig("assets.xml") ok,this is all! Public Methods EasyLoader() addFile(path:String, alias:String = "", loadTip:String = "", autoRemove:Boolean = false, method:String = "text"):void addType($type:String, $name:String):Boolean dispose():void disposeFileByAlias(alias:String):Boolean disposeFileByName(name:String):Boolean getFileByAlias(alias:String):LoadedItem getFileByIndex(number:uint):LoadedItem getFileByName(name:String):LoadedItem init(obj:* = null, $autoLoad:Boolean = true, $ignoreError:Boolean = true):Boolean loadConfig(str:String):void pause():void removeFileByAlias(alias:String):Boolean removeFileByName(name:String):Boolean start():void unPause():void
VIEWS ON THIS POST

179

Posted on:

Thursday 25th October 2012
View Replies!

goto next frame

mm was wondering. if on my main time line i have 2 movie clips(mc1 and mc2) on 2 different layers on frame 1.. on frame 2 there are 2 movie for mc1 and mc2 which will play when ill click on mc1 or mc2.. how do i do so that when i click on mc1, it goes to frame 2 and plays a movie on teh same layer as it is.. and not mc2 layer name frame1 frame2 movie1 [mc1] [movieMc1] movie 2 [mc2] [movieMc2]
VIEWS ON THIS POST

122

Posted on:

Thursday 25th October 2012
View Replies!

Movie clip button:Down state:How many frames?

Guys... how long or how many frames can be movieclip for Down or Click Event...It seems than only few like 15frames. When I click the button it plays only few of those I really have... What do you think
VIEWS ON THIS POST

91

Posted on:

Thursday 25th October 2012
View Replies!

gotoAndPlay frame in main scene help! AS 3.0

I have a mc INSIDE one of the layers in main scene, how to make it go to specified frame back on the main scene, when finished playing Flash, cs4, as3. Thnx.
VIEWS ON THIS POST

102

Posted on:

Thursday 25th October 2012
View Replies!

Targeting labeled frame from xml

how do I target the labeled frame in my main timeline. this is my xml code this is my *.*as code private function checkURL(m:MovieClip):void { if(menu_array[m.id].url!=null) { var request:URLRequest=new URLRequest(menu_array[m.id].url); navigateToURL(request,menu_array[m.id].target); } else { trace("Add actions here"); } } can you please modify that for me please ;-)
VIEWS ON THIS POST

121

Posted on:

Thursday 25th October 2012
View Replies!

gotoAndStop NEXT label frame

Is there a way to move to next (not specified) label frame without indicating a specific name I have a portfolio movie clip with images, using the AS3 Tween Class. I have a "next" button that hopefully will trigger the tween to NEXT label. here is my code: var myLabels:Array = ["print", "printA", "printB", "printC", "printD", "printE", "printF"]; next_btn.addEventListener(MouseEvent.CLICK, clickNextSection); function clickNextSection (evtObj: MouseEvent){ trace ("The"+evtObj.target.name+"button was clicked!") gotoAndStop (NEXT LABEL FRAME);
VIEWS ON THIS POST

69

Posted on:

Thursday 25th October 2012
View Replies!

Play frames before gotoAndPlay

, I'm currently breaking my head over an issue I have with a site I am making in Flash. After I click a button I need it to play a number of frames before doing a gotoAndPlay. I tried to do this with two variables and then change them in a function. this is the code Code: stop(); var previousPage:String = "home"; var currentPage:String= ""; function gotoPage(about) { var previousPage = currentPage; var currentPage = "about"; this.gotoAndPlay(previousPage + "-out"); } bthome.addEventListener(MouseEvent.CLICK, gotoPage); btabout.addEventListener(MouseEvent.CLICK, gotoPage); btmusic.addEventListener(MouseEvent.CLICK, gotoPage); btlyrics.addEventListener(MouseEvent.CLICK, gotoPage); And then after the frames I needed it to play Code: stop(); addEventListener(Event.ENTER_FRAME, homeout); function homeout(evtObj:Event) { gotoAndStop(currentPage); } There probably is a simple way to do this but I'm fairly new to AS3.0, any help would be very much appreciated!
VIEWS ON THIS POST

74

Posted on:

Thursday 25th October 2012
View Replies!

Play objects at different framerate

I want some of my flash object to play faster other to play slower at same moment. Can i play my flash movie objects at different framerate at a time
VIEWS ON THIS POST

107

Posted on:

Thursday 25th October 2012
View Replies!

Dynamically create keyframes

Hi all I am dynamically loading jpg files at runtime. What I want to do is to load each jpg file in a separate keyframe of an empty movie clip. I have 2 questions can you dynamically create keyframes in AS3.0. For each loaded picture I want to add a new keyframe which will contain the pictureif the above is not possible and I have to pre-define the keyframes, how do I access a specific keyframe of the movieclip to load the dynamically loaded pictures at specific keyframes
VIEWS ON THIS POST

85

Posted on:

Thursday 25th October 2012
View Replies!

Need Help : Going Back frames!!

all So i am building a portfolio and have my main stage with three frames, the first is my navigation section with 2 buttons button 1 sends the playhead to frame2 and button sends the playhead to frame3 etc here is the code stop(); ShowReel_btn.addEventListener(MouseEvent.MOUSE_DOW N , Showreel) function Showreel(evt:MouseEvent) : void { gotoAndStop(2) } VizualTech_btn.addEventListener(MouseEvent.MOUSE_D OWN , Viz) function Viz(evt:MouseEvent) : void { gotoAndStop(3); } and that works now on frames 2 and 3 i have a button that has this code Home_btn.addEventListener(MouseEvent.CLICK , goback ); function goback(evt:MouseEvent) : void { gotoAndPlay(1) } and it works but gives me this error : TypeError: Error #1009: Cannot access a property or method of a null object reference. at WorkingMain_fla::MainTimeline/frame1() at flash.display::MovieClip/gotoAndPlay() at WorkingMain_fla::MainTimeline/goback() it does put me back on to the frame 1 but the buttons dont work after that...... ....this wouldnt have happened in AS 2.0 anyidea how to get around this please
VIEWS ON THIS POST

47

Posted on:

Thursday 25th October 2012
View Replies!

keeping movie clip button on down frame

I'm pretty new to flash and as3 and could use some help. I have a sub menu with two movie clip buttons, let's call them mc1 and mc2. They both have a MOUSE_OVER event and a MOUSE_OUT event that work correctly. I'm trying to get them so that if mc1 is clicked then it will stay at the "over" frame and if mc2 is clicked mc1 will revert back to the "out" frame while the second will stay on its "over" frame. What seems to be happening in my code is that the MOUSE_OUT event is overriding the MOUSE_DOWN event. So, when I take the mouse off after I've clicked mc1 the over state goes away. I've tried many of my own failed ideas and search the internet for hours trying to figure this out. Maybe I'm just not searching for the right keywords, but I haven't found anything that helps. Any advice, tips or links would be greatly appreciated! Here's my code thus far: import flash.events.MouseEvent; import flash.display.* addEventListener(MouseEvent.MOUSE_OVER, mc1_over); addEventListener(MouseEvent.MOUSE_OUT, mc1_out); addEventListener(MouseEvent.MOUSE_DOWN, mc1_click); function mc1_over(event:MouseEvent):void{ gotoAndStop("over") } function mc1_out(event:MouseEvent):void{ gotoAndStop("out") } function mc1_click(event:MouseEvent):void{ gotoAndStop(16); if (MovieClip(root).mc2.currentFrame == "16") { MovieClip(root).mc2.gotoAndStop("out"); } }
VIEWS ON THIS POST

138

Posted on:

Thursday 25th October 2012
View Replies!

Dynamic Text Field on top of button (not easy)

, I have a grave problem and help is much appreciated. I have a MC, and made it behave like a button: b2.addEventListener(MouseEvent.MOUSE_OVER, mOver); b2.addEventListener(MouseEvent.MOUSE_OUT, mOut); b2.addEventListener(MouseEvent.MOUSE_UP, mUp); b2.buttonMode=true; b2.mouseChildren=false; (example of one instance of the MC called b2) Now I need to add a dynamic textfield on top of it. The problem is this text field is not "clickable" and you do not get the hand icon when you hover. So.. 1) I tried embedding the dynamic text field inside the MC. This fixes the problem but creates another one: I use the MC in several places and I "skew it" for effect..the text comes out skewed..I need the text to remain intact 2) I tried placing a transparent MC on top of all this to act as a "hit area". Named it tb2 and used: tb2.addEventListener(MouseEvent.MOUSE_OVER, mOver); tb2.addEventListener(MouseEvent.MOUSE_OUT, mOut); tb2.addEventListener(MouseEvent.MOUSE_UP, mUp); tb2.buttonMode=true; tb2.mouseChildren=false; problem is, inside the event handlers MOUSE_UP,over..etc I use the event.Target to take some action. Well now the target is not the original MC and code errors out. Anyway to fire an event on behalf of another MC So event.Target points to the other MC Any ideas much appreciated. I am really stuck!
VIEWS ON THIS POST

166

Posted on:

Thursday 25th October 2012
View Replies!

Problem getting different frames of video - code attached

I need to get random frames of a video on request. I am using bitmapdata.draw(video) for this. But the problem I am facing is that I am not getting the snapshot of the exact frame. The video is there on localhost so I suppose the problem cannot be of Enhanced seek. What happens is that when I do ns.seek(someTime), the videoContainer displays the required frame but the snapshot is taken according to ns.time ( which is not changing upon ns.seek(someTime)). So, the snapshot is something else and the videoContainer is displaying something else. Wierd!! function manageData(str:String):void { var frameno:int=int(str); trace("frame requested >> " + frameno*vidDuration/vidTotalframes); var bmd:BitmapData=new BitmapData(vidWidth,vidHeight); var scale1:Number=vidWidth/videoContainer.width; var scale2:Number=vidHeight/videoContainer.height; var myMatrix:Matrix = new Matrix(); myMatrix.scale(scale1,scale2); trace("the time is >> " + ns.time); ns.pause(); ns.seek(frameno*vidDuration/vidTotalframes); bmd.draw(videoContainer,myMatrix); var bitmap:Bitmap=new Bitmap(bmd); var sampleMc:MovieClip=new MovieClip(); sampleMc.addChild(bitmap); this.addChild(sampleMc); }
VIEWS ON THIS POST

150

Posted on:

Thursday 25th October 2012
View Replies!

Accessing instances on second frame

I can't seem to access instances in a movie clip that aren't on the first frame of a parent movie clip even if I tell flash to go to that frame before I attempt to reference the instance in the actionscript. Actually this works in flash player 10 but not 9. I could just export for flash player 10 but I would rather know the answer than just avoid it and of course for better compatibility reasons. I've attached an fla example with source code to show the problem. I'm using CS4 and programming in classes in as3 as you will be able to see from the example. Any help from anyone who knows how to do this properly would be greatly appreciated.
VIEWS ON THIS POST

116

Posted on:

Thursday 25th October 2012
View Replies!

help with buttons in different frames

I'm trying to make a button in each frame which directs to different URL in each frame, and buttons which navigate between the frames right. http://www.speedyshare.com/419769564.html Here I uploaded the *.fla file (Couldnt attach to kirupa, cause of the very small size limit) Throws 1009 error for me. How can I make my idea happen Maybe someone can say how this kind of things are done the proper way...
VIEWS ON THIS POST

154

Posted on:

Thursday 25th October 2012
View Replies!

Access movie clip on different frame of main timeline

I have two frames in the timeline of my flash file. On frame 1 there is a movie clip. How can I access this movie clip with code located in frame 2 It doesn't matter whether the mc is already placed on the stage or is added dynamically from the Library - I just need to access the alpha property. I can provide a more detailed description of my file if needed.
VIEWS ON THIS POST

113

Posted on:

Thursday 25th October 2012
View Replies!

removeChild from different frame?!?!

hello again friends... happy easter! I am having a rough time dealing with this problem: I have a set of buttons on the main timeline that gotoandplays movieclips that reside in different frames. These movieclips are on the stage by using addChild statements. As I click a button and it takes me to that specific frame, I am having hard time removing these movieclips using conditionals when I click on one of the buttons... I know it is hard to explain, but it probably is a simple problem a noob like me can't solve... I tried to replicate my problem in the attached source file... so it may be easier for someone to understand my specific question. *Again, I have to use addChild statements for these movieclips on each frame... I know this would be no issue if it were just timeline object based... Please help! It would be greatly appreciated... and happy easter!
VIEWS ON THIS POST

87

Posted on:

Thursday 25th October 2012
View Replies!

click X times to go to next frame.

I'm a newbie to action script, and first time posting here. Hope I can get some help over here, my question could be very simple to some pros here. My idea is after the user click maybe 4 or 5 times, the iconContainer will fade away and loads into the code on frame 2. School only teaches me this. But after one clicks it goes to Frame 2 right away, so my question is How do i do to set gotoAndStop after 5 clicks And how do I make the iconContainer slowly fades away instead just vanished
VIEWS ON THIS POST

101

Posted on:

Thursday 25th October 2012
View Replies!

Go to a frame when FLV has finish playing

(apologies if ive submitted this question twice, i think this is where is should live!) Guys, As the title suggests, Ive got a standard flash file with the option to play one of three FLVs and when each flv is clicked it makes the others stop. What I need to do is set an action so that when an flv reaches the end of its duration it goes to a specific frame in the timeline Im new to Actionscripting so any help will be appreciated!
VIEWS ON THIS POST

72

Posted on:

Thursday 25th October 2012
View Replies!

Using elements not defined in first frame of a movieclip

Hi all I've finally made the leap in to AS3 - it seems much nicer and easier than any of its predecessors but I'm still getting stuck on the odd thing. This is something I haven't been able to resolve with Google: I have a movieclip with an instance name "myMC". On the first frame inside myMC I have another movieclip called "point". On the second frame inside myMC I have a movieclip with instance name "smallBox". This works: myMC.point.transform.colorTransform = c; This does not: myMC.smallBox.transform.colorTransform = c; Do I need to do something to indicate I'm working on frame 2 Ta, lenny
VIEWS ON THIS POST

76

Posted on:

Thursday 25th October 2012
View Replies!

looping for a specific no. of times(e.g 3) and go to the next frame

hello there, i am experimenting with four rotating objects, the animation is perfect, my only problem is i cnt get it to stop and go on to the next frame, and the animation is called on by a separate actionscript file, i ve this code to try n stop the animation but it doesnt work, plizzzz help! maxPlays = 3; // this is the max number of times i want to play it. if (timesPlayed == undefined) { var timesPlayed:Number = 1; // this is where i will keep track of how many times i have played the loop. } // this will create the counter if (timesPlayed < maxPlays) { // if its less than the max number of plays timesPlayed++; // it plays again gotoAndPlay(2); // play it again } else { // if it has played the amount of times wanted stop(); // don't play again }
VIEWS ON THIS POST

122

Posted on:

Thursday 25th October 2012
View Replies!

Calculating position & angle relative to a frame of reference

In a game I'm working on, the player controls the main gun turret of a space ship. The turret's sprite is a child of the spaceship's sprite. As the ship moves and rotates, so does the turret. Quite often, the game needs to know/set what the "absolute" position & angle of the turret is. For example, the turret will rotate to point toward the player's mouse when it's within the viewport (the viewport being the part of the game representing the action). The only way I've been able to get this to work is: 1) Use localToGlobal to find out where the Sprite is relative to root. 2) Use localToGlobal to find out where the viewport is relative to root. 3) Calculate the difference. This gives me the turret's position in the viewport. To turn the turret toward the mouse: 1) Get the mouse position in the viewport the normal way. 2) Calculate the difference from the turret's position. 3) Use atan2 to get the "real" angle. 4) Add the ship's current rotation to the real angle to figure out what the turret's sprite's rotation should be. Has anyone else found a better way to do this
VIEWS ON THIS POST

79

Posted on:

Thursday 25th October 2012
View Replies!

Conditional statement problem - which frame to play based on variable

, I have a problem which I'm sure is very basic to most of you, but I could really use the assistance. I have a flash that will always have a consistent lead animation (part A), then a variable middle section (parts B,D), and a consistent ending animation (part C). I want to movie to be able to play on a loop with the first middle section, then go back to the beginning and play the movie with the second middle section. So it would play out A, B, C, then reset and play A, D, C, then A, B, C again, et cetera. I'm not a great scripter. I thought I if set two conditions in the first two frames and then based on what the variable was, control it from there, but no luck. I have attached a quick version of what I was looking to do. I'd very much appreciate any help that you can provide. Thank you very much!
VIEWS ON THIS POST

161

Posted on:

Thursday 25th October 2012
View Replies!

Rotation with time (prob easy *noob here)

I have a flash file that is 730px by 250 tall. It has 3 buttons that when clicked shows the image assigned to the button. The image is in an XML file so i can change them quickly. The buttons do work. Now the next thing im trying to achieve is an autoplay. I want flash to rotate automatically between the images on the buttons. Below is the code i have and im not sure if im even going the right way with this but here it is. My goal is to get something like what is on the home page of www.genielift.com. PHP Code: functionrotator(Event:Timer){vari=1;while(i
VIEWS ON THIS POST

95

Posted on:

Thursday 25th October 2012
View Replies!

Get object in different frames

In my main scene a I have a movieclip with various frame. With "movieclipname.objectname" I can get all the objects on the 1st frame of the movieclip. If I try with "movieclipname.object-on-another-frame" I can't get it. How can I get the objects on the other frames of the movieclip
VIEWS ON THIS POST

74

Posted on:

Thursday 25th October 2012
View Replies!

MovieClip across keyframes

, I'm having a really annoying problem with ActionScript 3 and finding MovieClips. It's a little hard to explain but I'll try my best. I have a MovieClip that is an animated character that spans across about 30 keyframes. Within that MC, there is a gun in its own MovieClip that appears on each frame of the characters clip. That gun needs to rotate to the mouse. I tried giving the gun MC the same name on each frame of the character, but then Flash only draws it once on the first frame instead of redrawing it throughout the character MovieClip. Does anyone know how I can put this gun in the character but still be able to call it with ActionScript in order to rotate it and manipulate it
VIEWS ON THIS POST

91

Posted on:

Thursday 25th October 2012
View Replies!

How to count how many frames are there in a MovieClip?

Assume I have a SWF file with the following structure - On the main timeline: Movieclip A appears on stage and begins in frame 1. It stops in frame 100 and goes away. Movieclip B appears on stage and begins in frame 20. It stops in frame 200 and goes away. Inside Movieclip B timeline: Movieclip C appears and begins in frame 40. It stops in frame 400 and goes away. I want the following function function getNumFrames(aSWFClip:MovieClip):int Originally, I thought I can just iterate through each child with getChildAt() and count how many frames each one requires. However, because not all the children get added immediately to the main timeline, getChildAt() does not always return 'ALL' children. What should I do
VIEWS ON THIS POST

83

Posted on:

Thursday 25th October 2012
View Replies!

AS3 - framerate independent game

im trying to switch my game, that is using onEnterFrame to update the game, over to a timer based update so it will be frame rate independent. how is something like this achieved
VIEWS ON THIS POST

63

Posted on:

Thursday 25th October 2012
View Replies!

Calling function on main stage from within a movieclip

Hi I'm new to as3 and going round in circles. I want to make 5 buttons visible after a logo has animated. I have a function called vis that successfully makes the buttons visible. How do I call this from within the movie clip (instance name 'logo') first frame of main timeline code: stop(); function vis () { webMC.visible = true; animMC.visible = true; interactMC.visible = true; dMC.visible = true; soundMC.visible = true; cvMC.visible = true; contactMC.visible = true; } webMC.visible = false; animMC.visible = false; interactMC.visible = false; dMC.visible = false; soundMC.visible = false; cvMC.visible = false; contactMC.visible = false; code on last frame of logo movie clip: stop(); this.parent.logo.vis();
VIEWS ON THIS POST

130

Posted on:

Monday 29th October 2012
View Replies!

video display

in my videodisplay, i'm loading a file from my server... it's a small enough file (couple MB)... however, the problem I end up with (and something i'm looking for a fix for), is that there's the initial app loading period (few seconds), but then I need to wait up to 15ish seconds before the video starts... i'm looking for a way to play it as it's downloading (like Youtube does).... i would like it to show how downloaded it is, but that's not necessary...
VIEWS ON THIS POST

98

Posted on:

Friday 30th November 2012
View Replies!

Selection.setFocus problem

I want to set the curcor point into the input box automatically when it enter into the particular frame. I use the code below: QuoteSelection.setFocus(messagebox);
VIEWS ON THIS POST

48

Posted on:

Friday 30th November 2012
View Replies!

Flash cs5 AS3 Errors in IE 7 & IE 8

Hi Friends, I am having little issue in loading external swf on click. It shows error in flash TypeError: Error #1009: Cannot access a property or method of a null object reference. at Aerial_View_fla::MainTimeline/pageload() each swf has its loader code, and main movie controlls the external swf's. for your reference i have attached the fla cs4 versions im using cs5. the same errors are prompting in >ie browsers ff and ie6 wroks well. please help me.
VIEWS ON THIS POST

66

Posted on:

Monday 31st December 2012
View Replies!

send Value from function to variable . . .help me

hi how i can send value to variable from variable arguments\t PHP Code: varnum:Number=0 functionff(e:Number):void{ \t\te=55 } ff(num) trace(tt)//0
VIEWS ON THIS POST

76

Posted on:

Monday 31st December 2012
View Replies!