actionscript-3

Best way to get a variable from another class in AS3

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 20:14:56
问题 I wonder which one of these methods is the best when trying get a variable from anotherClass to the Main-document-class, and why? Are there any more, even better ways? In example no 1, and the Main-function, can the if-else statement be triggered before the checkLogin function was completely done? Thanks! My no 1. way public class Main extends MovieClip { // Declaring other classes. private var checkLogin:CheckLogin; public function Main() { checkLogin = new CheckLogin(); if(checkLogin

import fl.data.DataProvider; is not working in Adobe CS4

删除回忆录丶 提交于 2019-12-13 20:12:06
问题 How can I use import fl.data.DataProvider; in Adobe CS4. When I try to import it showing 1172: Definition fl.controls could not be found. 回答1: the fl library will not show up in your IDE until you drag a component that actually uses it (in this case, a component that uses a data provider) into your library. you can manually add fl to your class path if you want so that it's always there, but it's not more useful since you'll need the target component in your library during compile time anyway

Basics in for loop in actionscript 3 in flex

限于喜欢 提交于 2019-12-13 20:06:42
问题 Good Morning stackoverflow... I'm having a problem.... this is my sample code var i:Number = new Number(); trace("showarray length" + showArray.length); for(i=0;i<showArray.length;i++){ trace("equal daw" + showArray.getItemAt(i).id + "==" + num); if(showArray.getItemAt(i).id == num){ showArray.removeItemAt(i); } } trace('alerts'); myproblem here is...wherenever the if is satisfied it stops looping it immediately goes out of the loop this is a sample output given that the length of showArray

Actionscript-3 namespaces and dynamic types?

谁说我不能喝 提交于 2019-12-13 19:41:44
问题 Okay, so this is a strange one... Is it possible to add namespaced members to anonymous or dynamic types? Say, if you wanted to "flag" a builtin type as "touched" for example? Earlier I thought about adding hidden members to StyleSheets and their inner styles and wondered how I'd prevent them being overwritten or serialized or whatever. I gave up because there are plenty of other ways to do what I wanted and deadlines loom - but I'd still like to know if it is at all workable? I've been

User Agent is not accessible in Internet Explorer 8 using ActionScript 3

不羁岁月 提交于 2019-12-13 19:14:28
问题 I am using the code below to find the User Agent using ActionScript 3: var userAgent:String = ExternalInterface.call("navigator.userAgent.toString"); The code is working in Firefox 13, Google Chrome & Opera, but the User Agent value as null in IE8. Is there any code snippet that will work here or any other way to implement this? 回答1: toString is unnecessary, since userAgent is a string property. Use this syntax instead: var userAgent:String = ExternalInterface.call("function(){return

call AS function from javascript/jquery

无人久伴 提交于 2019-12-13 18:25:24
问题 Using jquery,JS can we call a function in flex code.Below is that i have a button which calls a AS code.Can this be done if so how ? <script> function callas() { addBody();//call flex function } </script> <input type="button" onclick="callas();" /> FLEX code <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import mx.controls.Button; import mx.controls.Alert; import flash.display.InteractiveObject; import

Get the upper, bottom, rightmost and leftmost point of a pixel-perfect BitmapData collision

给你一囗甜甜゛ 提交于 2019-12-13 18:11:02
问题 How can I get the upper, bottom, rightmost and leftmost point of a pixel-perfect BitmapData collision? This is my collision-detection code: public static function checkCollision(object1:*, object2:*, debug:Boolean = false):Boolean{ var object1Rect:Rectangle = object1.getRect(stage); var object2Rect:Rectangle = object2.getRect(stage); var object1Point:Point = new Point(object1Rect.x, object1Rect.y); var object2Point:Point = new Point(object2Rect.x, object2Rect.y); var bitmapData1:BitmapData =

Flex 4.0/4.5 global error handling

狂风中的少年 提交于 2019-12-13 18:05:48
问题 I'm trying to use the new(ish) AS3 global error handling class. I am trying to use it within a Flex mxml application. I can't get it to work at all. Below is an entire program that shows the problem. I set this to use Flash Player 10.2 and compiled with the Flex 4.5 SDK. I've tried using Flex SDK 4.0 and 4.5 but I get the error in either case. I must be missing something obvious here. This is a normal Flex SWF file that will be shown on a web page. Assuming I could import the

How do I use AS3 to embed an SWF file and control is using .play()?

只谈情不闲聊 提交于 2019-12-13 18:01:10
问题 I have a folder "/assets/animations" filled with .swf files. I would like my AS3 script to embed all these assets so they can be later called to play or stop. I hear a lot about the Loader class but it looks like it doesn't embed all the files at compile time but rather grab them from a url when needed. Basically these assets are cut scenes for a flash game. I would like all of them to be present in one final .swf so its easy to play on any machine without an internet connection. 回答1: [Embed