actionscript

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

access mxml component from external actionscript file

老子叫甜甜 提交于 2019-12-13 18:47:23
问题 i'm trying to access an mxml component from my external as file. e.g main.mxml:<br> <code>[mx:text id="myText" />]</code> file.as:<br> <code>var mainM:main = new main(); mainM.text.visible = true;</code> I get the following error: [TypeError: Error #1009: Cannot access a property or method of a null object reference] Any suggestions on how to approach it better. 回答1: The ID of your component instance becomes a member of your application and can easy be accessed like so import mx.core

How to get Flex components to fill available space using Actionscript

只谈情不闲聊 提交于 2019-12-13 18:31:09
问题 I was laying out my Flex components using mxml and had them working correctly. But then I wanted to switch them over to Actionscript because I wanted them to extend a base component that provides default functionality. I've go the code working except that my components that used to fill the entire space using width="100%" and height="100%" appear to display just using the default sizes. Do you know How I can get them to take up the entire space again? Here is a test component I am playing

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 =

Comparing two Date values in ActionScript - possible to compare whole day values?

非 Y 不嫁゛ 提交于 2019-12-13 17:29:33
问题 I need to be able to compare the number of whole days between two dates in ActionScript, is this possible? I'd like to test if one date is 7 days or less after today, and if so is it one day or less (if it's before today this also counts). The workaround I have in place is using the .time part of the date field: // Get the diffence between the current date and the due date var dateDiff:Date = new Date(); dateDiff.setTime (dueDate.time - currentDate.time); if (dateDiff.time < ( 1 * 24 * 60 *

Flash Printing - Chrome Omits Sprites When Printing

醉酒当歌 提交于 2019-12-13 14:07:53
问题 Quick Summary We have a Flash application (AS3) that gives users the ability to read, interact and print content embedded within it. We've recently noticed that when printing from Chrome, content is omitted and empty pages are printed (note, blank pages appear in Chrome's print preview as well). We're seeing this issue with Chrome's version "21.0.1180.83" (using Flash Version " 11.3.31.230 "). This is not reproducible in any other browser. Technical Details Each page of content is represented

Actionscript 2.0 to 3.0, please give a hand, am I converting wrong?

天涯浪子 提交于 2019-12-13 09:33:05
问题 I'm doing the Actionscript 2.0 to 3.0 work but I have very few idea on 3.0, Can somebody good guys help to make a translate please! I have try to finish a version but my work just cannot being "drag n drop" after changing the codes. stop(); var randomPositionFrame = int(Math.random()*9)+1; content_mc.gotoAndStop(randomPositionFrame); for(var i=1; i<=5; i++){ eval("content_mc.matching_term_"+i)._alpha = 0; eval("content_mc.matching_term_"+i).onPress = function(){ if(this._currentframe == 1){

Infinite Loops (Action Script 3)

淺唱寂寞╮ 提交于 2019-12-13 08:39:45
问题 I'm new to Flash Actionscript because my programming class uses it. I normally use C++ (or a variant of it) and have dabbled in Java, so Actionscript was mostly familiar to me. However, whenever I use a while loop, AS3 crashes after 15 seconds. I need to use a while loop otherwise the scope of the entire code will end and the game will stop running on code I presume. In my normal programming language, while (true) will hang the game unless I have Waitframe(); somewhere in the code to let it

Passing variable from javascript to flash

北城以北 提交于 2019-12-13 08:39:09
问题 I have a flash music player that I would like to accept a parameter via a button click on a website. I'm thinking I could do this with javascript but not sure how. Does anybody have any sample code for both the javascript and what I would use to request the variable inside my actionscript code? Thanks, I appreciate it! 回答1: http://painteddigital.com/2008/calling-flash-as3-functions-from-javascript/ In the flash add a callback for the javascript function: import flash.external

Stop the main timeline from within a Class function

白昼怎懂夜的黑 提交于 2019-12-13 07:43:27
问题 I need to stop the movie at the first frame using a function from a class, I know I can use stop(); or this.stop(); but how do I stop the main timeline from within a class function? package { public class myApplication { public function myApplication(stageRoot:Stage) { stop(); // this doesn't work this.stop(); // this doesn't work either } } } 回答1: You can access the main timeline from any display object (that is on the display list) by using the root keyword: MovieClip(root).stop(); If your