SEARCH YOUR SOLUTION HERE  

Flash keyboard event and controlling timeline

I am very new to AS3. I have not wanted to migrate to it, but have been forced to do it for a current project which uses AS3 components. I am creating a slideshow (full screen) and will be creating each slide as a separate SWF file. I have been successful in loading and unloading the slides (SWF's). I need to use the arrow keys to move through the slides. I have that working, but want to load the slides without hard coding everything in each frame of the main timeline. I am using a var to get the currentFrame value. is well exept that if the left arrow key is pressed and the main timeline is on FRAME 1, the playhead seems to think it can go backward to frame zero and then into negative numbers with each press of the left arrow key. I need to be able to stop the timeline from advancing backward at frame one. I have tried several methods that either do nothing or cause the right arrow key to work unpredictably and keep returning to FRAME 1 no matter what if statement and evaluation I perform. Here's the current code on FRAME 1 of the main swf:
Code: stop(); stage.displayState = StageDisplayState.FULL_SCREEN; import flash.net.URLRequest; import flash.display.Loader; import flash.events.Event; import flash.events.ProgressEvent; var swf:MovieClip; var loader:Loader = new Loader(); var defaultSWF:URLRequest = new URLRequest("slide1.swf"); loader.load(defaultSWF); addChild(loader); var currentFrameNumber:Number; currentFrameNumber = currentFrame; function setup() { stage.addEventListener(KeyboardEvent.KEY_DOWN, useKeys); } setup(); this.stage.addEventListener(Event.ENTER_FRAME, checkFrame); function checkFrame(e:Event):void { if (MovieClip(root).currentFrame

Posted On: Friday 12th of October 2012 03:03:57 AM Total Views:  136
View Complete with Replies




Related Messages:

How to send webcam image by email using flash only?   (132 Views)
Hi My project consists of: - Taking a picute using flash and webcam - Save picture in server - Send picture automatically using flash to a email specied in the beggining of the process Does anybody could send me some hints on how to start or any tutorials
flash classes...quick ?   (188 Views)
as i learn as3, and googling up and youtube-ing whatever i can find, i notice that, in alot of the files i check out for study, i notice that the person teaching will be like " download this package from xyz.com " and usually these classes / packages are named after the site or person etc.... does this mean that if i learn this persons tutorial for whatever effect im wanting to learn/implement...that that effect is based on THEIR files only and do these files dial home so for example, everything i need to learn, is it contained in their files alone (completely offline) or is it based on math thats dialing to somewhere on their servers cause someone told me something crazy like that and i dont want to use something that depends on code that exists/works only when in contact with their server. sounds crazy i know but...yeah
Flash help with flash script   (141 Views)
Hi every one, New to the site with a few problems. Need help asap. 1.I made an all flash website but some how it wont play by it self. I have to right click on the page and click Play in order for the flash to start. what can I do to fix this 2. I want to publish this flash that fits all screen sizes I used percentage and no scale, but when I open the site it a smaller screen it doesn't show all the website. how do I fix this
Flash flash banner not shown in browser   (130 Views)
hi, My flash banner is a sliding show with navigation made in AS3. I've checked it after uploading in internet explorer, firefox, chrome and safari and i tworked fine. My colleague checked it on his pc in internet explorer and he couldn't see it at all. Is there any script, which can remove blocking or tell the user to do it or update th ebrowser. Do u have any ideas how to fix it
Flash how to attach rular in component in flash or flex   (150 Views)
I have one application to design in which the scrollpane component is having scale or rular on the vertical and horizontal site so how can i do that i dont know please help me.. reference site.. www.speedysignsusa.com... the same applicaiton i need to develop in flash...
popup windows in front of fullscreen flash - help   (158 Views)
hi, I have and swf embedded into an aspx web page. I am using ExternalInterface.call to open windows using javascript Eeverthing is working fine when stage.displayState = "normal" However, all popup windows are diplaying behind the flash when stage.displayState = "fullScreen"; Does full screen mode allow the popup windows to be displayed just like normal mode if so, what is the trick
help with voting poll using php mysql and flash cs4   (159 Views)
ok i used a tutorial try it every thing is cool when i put the poll into a page and test it . but when i did put the poll movie clip inside another main movie clip . or try to load it as external poll.swf it dosenot return the values from php into the status_txt i donot know why . it load the variables from data base but when i try to vote again it suppose to tell me you already voted but it dosenot do this . it shows the processing mc and dosenot return the message you already voted from php parse file ! what is missing here Code: frame 1 layer 1 stop(); var variables1:URLVariables = new URLVariables(); var varSend1:URLRequest = new URLRequest("parse_my_poll.php"); varSend1.method = URLRequestMethod.POST; varSend1.data = variables1 ; var varLoader1:URLLoader = new URLLoader; varLoader1.dataFormat = URLLoaderDataFormat.VARIABLES; varLoader1.addEventListener(Event.COMPLETE, completeHandler1); variables1.myRequest = "load_numbers"; varLoader1.load(varSend1); function completeHandler1(event:Event):void{ count1_txt.text = "" + event.target.data.choice1Count; count2_txt.text = "" + event.target.data.choice2Count; count3_txt.text = "" + event.target.data.choice3Count; } frame 1 layer 2 processing_mc.visible=false; var choiceNum:Number=0; var errorsFormat:TextFormat = new TextFormat(); errorsFormat.color = 0X00F00; var successFormat:TextFormat = new TextFormat(); successFormat.color = 0X00F00; function btn1Click(event:MouseEvent):void{ choiceNum = 1; choice_txt.text = choice1_txt.text; } function btn2Click(event:MouseEvent):void{ choiceNum = 2; choice_txt.text = choice2_txt.text; } function btn3Click(event:MouseEvent):void{ choiceNum = 3; choice_txt.text = choice3_txt.text; } btn1.addEventListener(MouseEvent.CLICK ,btn1Click ); btn2.addEventListener(MouseEvent.CLICK ,btn2Click ); btn3.addEventListener(MouseEvent.CLICK ,btn3Click ); var variables:URLVariables = new URLVariables(); var varSend:URLRequest = new URLRequest("parse_my_poll.php"); varSend.method = URLRequestMethod.POST; varSend.data = variables1 ; var varLoader:URLLoader = new URLLoader; varLoader.dataFormat = URLLoaderDataFormat.VARIABLES; varLoader.addEventListener(Event.COMPLETE, completeHandler); function completeHandler(event:Event):void{ processing_mc.visible=false; status_txt.text = event.target.data.return_msg; status_txt.setTextFormat(errorsFormat); if(event.target.data.return_msg == "thanks for voting!"){ status_txt.setTextFormat(successFormat); count1_txt.text = "" + event.target.data.choice1Count; count2_txt.text = "" + event.target.data.choice2Count; count3_txt.text = "" + event.target.data.choice3Count; } } vote_btn.addEventListener(MouseEvent.CLICK , ValidateAndSend ); function ValidateAndSend(event:MouseEvent):void{ if(!choice_txt.length){ status_txt.text ="please choose before you press vote"; status_txt.setTextFormat(errorsFormat); }else { processing_mc.visible=true; variables.userChoice=choiceNum; variables.myRequest = "store_choice"; varLoader.load(varSend); } } php parseing file code
[ask]new sound causing flash to crash   (158 Views)
hello all adding this in my class (i name it CGame) Code: var ns = new mysound(); ns.play(0,1); makes flash cs4 crash. But not if it added to timeline/stage. I tried making new class with different name, then adding the code, and it works. So it just fails on CGame. any sugestions sorry for my very bad English
ReferenceError: Error #1056: Cannot create property ... on flash...   (157 Views)
all, Here is a specific problem I am facing most of the time; let me try to explain with an example. Say I create a shape, and I want to move it with a ENTER_FRAME event, like this: public function makeShape(){ var myShape=new Shape(); addChild(myShape); myShape.addEventListener(Event.ENTER_FRAME,moveMyS hape); } public function moveMyShape (event:Event) { event.currentTarget.x+=1; It is cool up to here. But what if I want to pass a variable with my shape to the event function. Say my shape has a no or a name or anything like a data; so I rewrite the code; public function makeShape(){ var myShape=new Shape(); myShape.thisShapesNo=50; addChild(myShape); myShape.addEventListener(Event.ENTER_FRAME,moveMyS hape); } public function moveMyShape (event:Event) { event.currentTarget.x+=1; trace(event.currentTarget.thisShapesNo) And now I get the error code, "Cannot create property thisShapesNo on flash.shape.. " OK, I understand that, but it is not fair. Anything you create with a code can have a property you want to dub or add on it, and you should call it anytime you like. I learned that there are 2 ways to get around it, but both of them are extra work for the code, and I don't like to spend that precious memory for a cheap error like this. First one is to add the shape as a child to a movieclip, I use this most of the time and goes like this: public function makeShape(){ var myShape=new Shape(); var myClip=new MovieClip(); myClip.addChild(myShape); myClip.thisShapesNo=50; myClip.addEventListener(Event.ENTER_FRAME,moveMySh ape); } public function moveMyShape (event:Event) { event.currentTarget.x+=1; trace(event.currentTarget.thisShapesNo) See the extra workload.. And the other way (and I've never tried) is to write your own event function where you can pass variables.. I guess something like this: myShape.addEventListener(Event.ENTER_FRAME, moveMyShape, 50 ); So it seems like this is another extra workload for the code. And so here is my question: How can I add a you-name-it property to any thing I've created in AS3
When sendind data from flash to php, get URL error in Firefox   (139 Views)
im sending some data to a php file, in order to save in DB. The data is being saved, but when I click in OK at the form button, I get the following error: Error: Error #2101: A String passada para URLVariables.decode() deve ser uma string de consulta codificada em URL que contm pares de nome/valor. at Error$/throwError() at flash.net::URLVariables/decode() at flash.net::URLVariables() at flash.net::URLLoader/onComplete() You can see the error at the site online: http://www.iconmedia.com.br/#/news and try sending the form using firefox. What could be wrong
hardware acceleration | flash site gets slow sound is played before motion gfx   (148 Views)
hey there i have a as3 flash site it runs great at my win pc (core 2 duo 4mb ram 1gb viga ) but when tested on Pentium 4 win pc it gets slower i have a streaming video and audio in the site at all the site became slower and especially the video doesn't look smooth what is the reason for that i noticed there is a hardware acceleration option in publish settings is it the reason or what is wrong on my flash site which works great on my core 2 duo pc i have a flashing animation with gun shots sound it works fine on the core 2 duo but in Pentium 4 the gun shoots sound is heard before the flashing animation
Capturing a javascript src ad zone text in flash   (139 Views)
all, I build flash web sites and have only a limited understanding of javascript. I am trying to monetize a flash page that I have built for myself and is getting an increased traffic. The page has to be flash as it is based on flash dynamic graphic capabilities. Besides I prefer to integrate and customize the ads into my page rather than use standard ad zones offered by the ad networks. I have a permission from a small ad network to convert their ads to flash but I was not able to do it myself. They use a standard java script src code for creating their ads. It looks approximately like this: They require though that the capturing will be done in a way that allows them to monitor my page. I can publish Flash player 9 so I can work with ExternalInterface.call Any hints on how to translate the code to Flash and how to change the html code will be helpful. I am also willing to pay someone who is interested in working with me directly via Email correspondance on properly placing the code. My Email address is newventure@live.com Many
flash.display.MovieClip   (103 Views)
Check link http://www.kirupa.com/developer/as3/classes_as3_pg1.htm after testing compiling giving error i.e. The class 'name' must subclass 'flash.display.MovieClip' since it is linked to a library symbols of the type why this error Code: package { public class Name { private var firstName:String; private var lastName:String; function Name() { } public function SetFirstName(val:String):void { firstName = val; } public function SetLastName(val:String):void { lastName = val; } public function GetFullName():String { return firstName + " " + lastName; } } }
$$ Rent your flash AS3 App out month by month and block non payers!   (129 Views)
I'm building a flash app game that I want people too rent from me monthly. How do I disable the app for nonpayment What ways will anyone of u do something like this Could I give each buyer a personal embed code for his website and if he doesn't keep up payments disable the embed code I have bin trying to think out a hack proof a strategy but can't. 1. Any Ideas 2. Also are there any automated ways like threw a membership subscription
The use of /#/ in urls on flash sites?   (139 Views)
I'm not sure where to post this because it could be related to ActionScript of Flex but I've noticed that a number of Flash sites have urls such as sitename.com/#/services/ which gives the ability to return to a specific area (in this case "services") of the site rather than staying on the homepage each time you go back to the page. As you navigate through the site the url changes to reflect where you are in the swf. I was wondering if anyone can explain what's being done here or point me to some resources that discuss this
flash syntax   (140 Views)
hi, I need help to understand the basic syntax. like: iXpos = (mouseX
loading dynamic images without flashing on mouse over   (171 Views)
I am using a loader (Loader.loadBytes()) to load multiple jpeg images (motion jpeg)continually whenever a new jpeg image is ready. However, when the mouse is moving over the loader, it seems to repaint everything including the background and causes the flashing. Is there a way to prevent this from happening without using the double-buffer concept Is there way to stop repainting the background Is the problem caused by the images loading or mouse over When the mouse is not moving over the loader, everything looks fine. However, when only a image is loaded by the loader, I think the display won't be flashing even though you move the mouse over it.
send a variable from one flash file another swf   (122 Views)
Guys i m using as3 for my project URLRequest("new.swfabc="+1); im sending my varaiable like this call a swf and sending variable... and i dont konw hoe to get the sent variable from file 1. Help me plzzzzzzzzz
flash animation is not correctly displayed in Firefox   (143 Views)
can anybody tell me why the flash animation is not correctly displayed in Firefox (and only the second time I visit the website) http://lancelmaat.nl/
Opening windows of a specific size from flash?   (115 Views)
, I'm just learning actionscript, and was wondering how to have the new window opened be a specific size. I've searched around, but only really found instructions for AS2. Here's the code I am using: stop(); var pharURL:URLRequest = new URLRequest ("http://link.com"); function pharClick(myevent:MouseEvent):void { navigateToURL(pharURL); } phar_btn.addEventListener(MouseEvent.CLICK, pharClick);