actionscript

Problems Scripting Multiple Buttons(nearly identical) in a single Action Script

一曲冷凌霜 提交于 2019-12-12 03:57:40
问题 I am a noob to action script 3 so please forgive this detailed Posting ! (and code posting errors) I am making an interactive flash Project...It has has 17 Separate scenes ... Intro Scene "Main_ Sequence" 15 Individually title song pages I have scripted the Intro-->"main" sequence with no problems .... Where my issue is the "main sequence" has 15 Buttons and I need to link them to the 15 separate scenes ...I have tried two different sets of code(see below) and kept getting Compiler Errors...

keeping track of a series of simple multiple choice web form answers

孤街浪徒 提交于 2019-12-12 03:48:42
问题 This is the code I'm trying to use , which seems logical. But doesn't seem to be working. MyAsFileName.prototype.getTotalScore = function() { var totalScore = 0; for (var i = 0; i < allQuestions.length; i++) { totalScore += allQuestions[i].getCalculatedScore(); if (currentModule.allQuestions[i].parent.questionCorrect == true) { knowledgePoints++; } else { knowledgePoints--; } } debugLog("Total score: " + totalScore); debugLog(knowledgePoints); return totalScore; } I have allQuestions defined

How Do I spawn Enemy at either the far left or the far right of the stage and have them move in to the center?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 03:47:57
问题 First I get This Error ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/removeChild() at Game_fla::MainTimeline/testCollisions()[Game_fla.MainTimeline::frame1:205] and here is my code // ******* IMPORTS ***** import flash.events.MouseEvent; import flash.events.Event; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import flash.display.MovieClip; import flash.events.KeyboardEvent; //*****VARIABLES*

Workaround for TextField bug in FP 10.3.183.5 and 10.3.183.7

社会主义新天地 提交于 2019-12-12 03:19:30
问题 I have a client who is having a big problem with an AS2 application we developed a few years ago. As far as I can tell, it is being caused by an acknowledged bug in recent versions of Flash Player (see http://forums.adobe.com/message/3859034 and https://bugbase.adobe.com/index.cfm?event=bug&id=2941694). Two versions of FP are affected (10.3.183.5 and 10.3.183.7), and the bug was fixed in 10.3.183.10. Obviously, upgrading Flash Player will fix the problem, but we all know users don't always do

ActionScript Class Number Communication

假如想象 提交于 2019-12-12 03:15:55
问题 I'm a little new to AS3, but I have a question. I have a variable called "lives". It is a Number. I also have a class. It is called "Enemy". Within the "Enemy" class, there is a function called "collision_detection". How can I change the value of "lives" from "collision_detection"? Thank you! EDIT: I have an Enemy class. I need to communicate from within the class to let the main program know that a collision occurred. How can I send this message to the main program? EDIT II: Here is the

How come drawing this line at (0,0) doesn't really draw it at (0,0)?

。_饼干妹妹 提交于 2019-12-12 03:09:35
问题 Update: Once and for all, how can I draw a line that goes from (0,0) to the opposite corner of the stage? Here is what I have: package { import flash.display.Sprite; import flash.display.LineScaleMode; import flash.display.CapsStyle; import flash.display.JointStyle; import flash.display.Shape; import flash.events.Event; public class Main extends Sprite { private var lines:Shape; public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private

How to disable default browser navigation with Space in Flex

雨燕双飞 提交于 2019-12-12 03:00:52
问题 I have defined a keyboard shortcut that uses space. After I have pressed the shortcut two things happen: some random navigation in my app and also the code in my eventHandler from the keyboard shortcut. I found THIS table with browser keyboard shortcuts and obviously space sometimes is used for navigation. So is there a way to stop the navigation with space in Flex, because eating the spacebar button doesn't seem to work: FlexGlobals.topLevelApplication.addEventListener(KeyboardEvent.KEY_DOWN

Escaping multiple characters in an ActionScript regular expression

北城余情 提交于 2019-12-12 02:59:39
问题 Are there special strings for that, such as \Q and \E in Java? Thanks. 回答1: As far as I know there is no equivalent to \Q and \E in AS3 RegExp. What you can do is the same thing you would in Javascript: escape special characters for use within a RegExp pattern: function escapeForRegExp(s:String):String { return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"); } // Example: var s:String = "Some (text) with + special [regex] chars?"; var r:RegExp = new RegExp("^" + escapeForRegExp(s), "g"); // Same

Define unique variable name

ⅰ亾dé卋堺 提交于 2019-12-12 02:46:36
问题 How to create a dynamic ArrayCollecton instance that use unque naming: ac1, ac2..ac999 whether user click a button. Without having to use hardcode variable name. 回答1: You can create dynamically named variables on dynamic classes like this: package { dynamic public class Test { public function Test() { this["a"] = 1; } } } now you could use this class: var t: Test = new Test(); trace(t.a); you'll notice that t has a property named "a" and its value is 1. So using a dynamic class you could

How can I create multiple types & params for custom events?

ε祈祈猫儿з 提交于 2019-12-12 02:42:57
问题 I have a custom event class and want to insert multiple parameters (like the native events: MOUSE_UP, CLICK, ROLL_OVER). Here's my code so far: package { import flash.events.Event; public class MenuGeneratorEvent extends Event { public static const PASS_PARAMS:String = "passParams"; public var param1:String = new String(); public function MenuGeneratorEvent(type:String, str:*, bubbles:Boolean = false, cancelable:Boolean = false):void { this.param1 = str; super(type, bubbles, cancelable); }