actionscript

ActionScript 3, How to get character to jump for longer

两盒软妹~` 提交于 2019-12-25 07:06:20
问题 I am making a platformer game in Flash (AS3) and the code I have below works. I want my character to jump high enough to allow it time to reach a platform. The only problem with code below is the speed at which it jumps up and down and the height of the jump. Tthe space bar is what triggers the function to run. Please help as I would much appreciate it! :) Player.addEventListener(Event.ENTER_FRAME, fl_MoveInDirectionOfKey); stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_SetKeyPressed);

AS3 Character jumping/falling problems

与世无争的帅哥 提交于 2019-12-25 06:59:32
问题 I am having problems with getting the character to jump/fail when the up arrow is pressed. I'm trying to make it so when the up arrow key is pressed once it will jump a certain height then fall. Here is my movement code: public var gravity:int = 2; public function fireboyMovement(e:KeyboardEvent):void { if (e.keyCode == 37) //right { fireboy1.x = fireboy1.x -5; checkBorder() } else if (e.keyCode == 39) //left { fireboy1.x = fireboy1.x +5; checkBorder() } if (e.keyCode == 38) //up { fireboy1.y

access dynamically loaded movieclip (stage > scrollpane > myloader > movieclip)

独自空忆成欢 提交于 2019-12-25 04:17:59
问题 what I'm trying to do is accessing snapText = scrollPane.source.textSnapshot; from an external swf. I've tried: trace("-->: "+scrollPane.source.textSnapshot.getText(0, 1000)); trace("-->: "+myLoader.content.textSnapshot.getText(0, 1000)); trace("-->: "+mc.textSnapshot.getText(0, 1000)); trace("-->: "+mc.getChildAt(0).textSnapshot.getText(0, 1000)); trace("-->: "+mc.getChildByName(myLoader).textSnapshot.getText(0, 1000) ); trace("-->: "+scrollPane.content.textSnapshot.getText(0, 100)); all of

Referencing a object that is on the stage inside a class?

最后都变了- 提交于 2019-12-25 04:15:07
问题 So I had the issue with ENTER FRAME so I moved it to a separate class and this is what the class looks like package { import flash.display.MovieClip; import flash.events.Event; import flash.accessibility.Accessibility; import flash.display.DisplayObject; import flash.display.Stage; public class enemy extends MovieClip { public function enemy() { // constructor code this.addEventListener(Event.ENTER_FRAME, moveEnemy); } public function moveEnemy(e:Event):void{ this.x += 5; if(stage.player

In ActionScript 3.0, can you use addEventListener for one class to react to the function call of another class?

南笙酒味 提交于 2019-12-25 04:07:49
问题 I know how to use addEventListener for one class to react to another class's button being clicked on. What if you want to use it for a more general purpose than that? What if you want to use it to react to one of the member functions of the other class being called? Is there a syntax for that? Thanks! Edit: Please note that I have already Googled for the answer. 回答1: You can create your own events and dispatch them from the other class and listen to them in your listening class. Here is some

When using the 'Class' datatype, how can I specify the type so I only accept subclass of a specific class?

孤人 提交于 2019-12-25 04:06:24
问题 I've got a method that accepts a parameter of type Class , and I want to only accept classes that extend SuperClass . Right now, all I can figure out to do is this, which does a run-time check on an instance: public function careless(SomeClass:Class):void { var instance:SomeClass = new SomeClass(); if (instance as SuperClass) { // great, i guess } else { // damn, wish i'd have known this at compile time } } Is there any way to do something like this, so I can be assured that a Class instance

When using the 'Class' datatype, how can I specify the type so I only accept subclass of a specific class?

烂漫一生 提交于 2019-12-25 04:06:18
问题 I've got a method that accepts a parameter of type Class , and I want to only accept classes that extend SuperClass . Right now, all I can figure out to do is this, which does a run-time check on an instance: public function careless(SomeClass:Class):void { var instance:SomeClass = new SomeClass(); if (instance as SuperClass) { // great, i guess } else { // damn, wish i'd have known this at compile time } } Is there any way to do something like this, so I can be assured that a Class instance

Is there a way to check the value of the loop parameter from ActionScript?

a 夏天 提交于 2019-12-25 03:44:34
问题 There are a number of parameters that can be added to object and embed tags to embed flash videos. Most are listed here. Some of them can be accessed/changed programmatically via ActionScript (e.g. <param name="scale"> can be accessed via stage.scaleMode ). Can the value for the loop parameter be accessed/changed? Edit to add: I know about flashvars, that's not what I'm asking. 回答1: The general net consensus is that no, you can not access parameters other than flashvars/movie from inside

Flash Actionscript 3 saving a XML file locally has a “Save As” window (How can I remove it?)

余生长醉 提交于 2019-12-25 03:40:47
问题 So, I have a flash application that handles several client profiles for a company. Whenever a new client profile is created, it saves a new XML file localy. My problem is that instead of doing a "silent" file creation, a window pops up just like doing a "Save As" as to confirm that the file is being saved on disk and which name should it be. Is there a way to do a file save within flash without it calling out that window? If so, would it be possible to link me to an example of it? Here is an

Flash Actionscript 3 saving a XML file locally has a “Save As” window (How can I remove it?)

痴心易碎 提交于 2019-12-25 03:40:12
问题 So, I have a flash application that handles several client profiles for a company. Whenever a new client profile is created, it saves a new XML file localy. My problem is that instead of doing a "silent" file creation, a window pops up just like doing a "Save As" as to confirm that the file is being saved on disk and which name should it be. Is there a way to do a file save within flash without it calling out that window? If so, would it be possible to link me to an example of it? Here is an