Search Results

Search found 908 results on 37 pages for 'as3'.

Page 6/37 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • AS3 function running before variables are defined!

    - by Jeffrey
    I am trying to add an init() function to a MovieClip, but when I run the function from scene1 the variables that were set in the MovieClip are not defined yet... The MovieClip was dragged to the stage from the library. scene1: mc.init(null); MovieClip: var _default = 5; function init(num) { if(num == null) { trace(_default); } else { trace(num); } } This is tracing "undefined" instead of "5"; Is there a way of fixing this problem?

    Read the article

  • AS3 Pass parameter by value

    - by alejandrobog
    Hi, im having problems with the following code: for (var i:Number=0; i<numFaces;i++){ var faceLoader:Loader = new Loader(); faceLoader.contentLoaderInfo.addEventListener( Event.INIT, function(fle:Event){ LoadCara(i,faceLoader); trace("LoadCara:" + i.toString()); } ); } function LoadCara(index:int,loader:Loader){ if(index == 0) { trace("cara1:" + index.toString()); cara1.removeChildAt(0); cara1.addChild(loader); } else if(index == 1) { cara2.removeChildAt(0); cara2.addChild(loader); }} The problem is that im sending the variable i to the function LoadCara on every iteration, and its always called with the last value of i. I would like this function to be called with the appropiate index. Hope I explain myself, thanks in advance.

    Read the article

  • Access main stage from class definition file (as3)

    - by staypuffinpc
    I'd like to access the stage of the main timeline from w/i a class that extends a movieclip. Basically, I have a button in the main timeline that makes a HUD appear. The HUD is an extended MovieClip class. When people click on a button in the HUD, I'd like to remove the object from the stage of the main MovieClip.

    Read the article

  • Find Upper Right Point of Rotated Rectangle in AS3 (Flex)

    - by coltech
    I have a rectangle of any arbitrary width and height. I know X,Y, width, and height. How do I solve the upper right hand coordinates when the rectangle is rotated N degrees? I realized if it were axis aligned I would simply solve for (x,y+width). Unforunatly this doesn't hold true when I apply a transform matrix on the rectangle to rotate it around its center.

    Read the article

  • AS3: How to dispatch from the document class?

    - by redconservatory
    I have a pretty good handle on dispatching from classes other than the Document Class, but what happens when I want to dispatch an event from the Document class and have other classes listen to the document class broadcast? It seems like there are several ways to approach this (i.e using a Singleton, using composition, using MovieClip(root)) I was just wondering what people find is the "best practice" way to do this?

    Read the article

  • AS3 Random repeat x seconds function

    - by Lilk
    Hi, I have the following function: function update(e:Event):void { var val:Number = Math.random() * 120; rgb.r.x = rgb.r.y = val; rgb.b.x = rgb.b.y = -val; } And im looping it with: stage.addEventListener(Event.ENTER_FRAME, update); But what I need to do would be something like: Random number between 1 and 20 If the number is > 10 Call function Update and keep caling it for 20 seconds else do nothing for 10 seconds Repeat this block of code forever Can someone help me write this please?

    Read the article

  • AS3: Performance question calling an event function with null param

    - by adehaas
    Lately I needed to call a listener function without an actual listener like so: foo(null); private function foo(event:Event):void { //do something } So I was wondering if there is a significant difference regarding performance between this and using the following, in which I can prevent the null in calling the function without the listener, but am still able to call it with a listener as well: foo(); private function foo(event:Event = null):void { } I am not sure wether it is just a question of style, or actually bad practice and I should write two similar functions, one with and one without the event param (which seems cumbersome to me). Looking forward to your opinions, thx.

    Read the article

  • as3 custom functions

    - by pixeltocode
    why is it that every time moveSlide() is called, the values traced are the same? var slideWidth:Number = 680; var newPos:Number; function moveSlide () { var currentPos:Number = image_holder.x; newPos = currentPos + slideWidth; trace('currentPos ' + currentPos); trace('newPos ' + newPos); } moveSlide(); moveSlide(); moveSlide(); (image_holder is a movieclip with the images)

    Read the article

  • AS3: Element stays on stage after manipulating the index(depth)

    - by o15a3d4l11s2
    Here is the problem I have: after I change the index of one movieclip using this code oldIndex=getChildIndex(DisplayObject(e.target)); setChildIndex(DisplayObject(e.target), numChildren - 1); when I give the object its old index setChildIndex(DisplayObject(e.target), oldIndex); and go to another frame of the movie, this element I have changed the index of stays on top of all elements on the new frame. My question is am I doing something wrong and if not, what can I do so that this element stays only in the frame it is placed.

    Read the article

  • Override existing AS3 classes

    - by purga
    For a custom derived class "Vector2" from flash.geom.Point, when trying to override the clone() method (similar to add(), subtract() methods that will return the type itself), it will always complain about incompatible overriding 'cuz the return type has been altered from "Point" to "Vector2". import flash.geom.Point; public class Vector2 extends Point { //Constructor is good public function Vector2(x:Number = 0, y:Number = 0) { super(x,y); } // Error: Incompatible overriding override public function clone():Vector2 //return type has to be "Point" { return new Vector2(this.x , this.y); } } How can we correctly reuse/override the methods provided by the super classes as supposed to create our own one (e.g. : a new clone1() method), or simply we just can't? Thanks.

    Read the article

  • iPhone development using AS3 (Resources)

    - by woodscreative
    I've just realeased my first game developed for the iPhone using AS3 and the iPhone Packager http://itunes.apple.com/us/app/snapshot-paintball/id407362440?mt=8&uo=4 I want to take the game to the next level but I am not using the native iPhone SDK so I need some other ideas, I am fresh to iPhone development and it's hard to find good resources, any AS3 developers out there willing to share some links? Highscore frameworks and best practices, connecting to Facebook, ui classes/gestures. Thanks.

    Read the article

  • Implicit vs explicit getters/setters in AS3, which to use and why?

    - by James
    Since the advent of AS3 I have been working like this: private var loggy:String; public function getLoggy ():String { return loggy; } public function setLoggy ( loggy:String ):void { // checking to make sure loggy's new value is kosher etc... this.loggy = loggy; } and have avoided working like this: private var _loggy:String; public function get loggy ():String { return loggy; } public function set loggy ( loggy:String ):void { // checking to make sure loggy's new value is kosher etc... this.loggy = loggy; } I have avoided using AS3's implicit getters/setters partly so that I can just start typing "get.." and content assist will give me a list of all my getters, and likewise for my setters. I also dislike underscores in my code which turned me off the implicit route. Another reason is that I prefer the feel of this: whateverObject.setLoggy( "loggy's awesome new value!" ); to this: whateverObject.loggy = "loggy's awesome new value!"; I feel that the former better reflects what is actually happening in the code. I am calling functions, not setting values directly. After installing Flash Builder and the great new plugin SourceMate ( which helps to get some of the useful features that FDT is famous into FB ) I realized that when I use SourceMate's "generate getters and setters" feature it automatically sets my code up using the implicit route: private var _loggy:String; public function get loggy ():String { return loggy; } public function set loggy ( loggy:String ):void { // do whatever is needed to check to make sure loggy is an acceptable value this.loggy = loggy; } I figure that these SourceMate people must know what they are doing or they wouldn't be writing workflow enhancement plugins for coding in AS3, so now I am questioning my ways. So my question to you is: Can anyone give me a good reason why I should give up my explicit g/s ways, start using the implicit technique, and embrace those stinky little _underscores for my private vars? Or back me up in my reasons for doing things the way that I do?

    Read the article

  • Help needed with Flash AS2 to AS3 conversion, having major problems...

    - by Mat
    Hi all, I have a project i need to update form AS2 to AS3 as i need some of the new functions available for vertical centering of text. My current AS2 code on the time line is as follows. var dataField = _root.dataField; var dataType = _root.dataType; var dataPage = _root.dataPage; var dataVar = _root.dataVar; _root.mc.onRelease = function() { getURL("index.php?page="+dataPage+"&num="+dataNum+"&"+dataType+"="+dataVar, "_self"); }; And my external AS file is as follows. import mx.transitions.Tween; /** * * StandardKey is attached to a movieclip in the library. * It handles the basic button behavior of the keyboard keys. * When each button is placed on the stage, it's instance name * will be the unique ID of the key. * */ class StandardKey extends MovieClip { /////////////////////////////////////// //Stage Elements var highlight:MovieClip; //End Stage Elements var highlightTween:Tween; function StandardKey(Void) { //Repaint the key with 0 alpha highlight._alpha = 0; } function onPress(Void):Void { //Do the highlight animation highlightTween.stop(); highlightTween = new Tween(highlight, "_alpha", mx.transitions.easing.Regular.easeInOut, 100, 0, 10, false); } } Here is my attempt at moving timeline and external AS2 to AS3 Timeline i now have : var dataField = this.dataField; var dataType = this.dataType; var dataPage = this.dataPage; var dataVar = this.dataVar; var dataNum = this.dataNum; _root.mc.onRelease = function() { navigateToURL(new URLRequest("index.php?page="+dataPage+"&num="+dataNum+"&"+dataType+"="+dataVar, "_self")); }; External AS3 i have package { import fl.transitions.Tween; import fl.transitions.easing.*; import flash.display.MovieClip; /** * * StandardKey is attached to a movieclip in the library. * It handles the basic button behavior of the keyboard keys. * When each button is placed on the stage, it's instance name * will be the unique ID of the key. * */ public class StandardKey extends MovieClip { /////////////////////////////////////// //Stage Elements var highlight:MovieClip; //End Stage Elements var highlightTween:Tween; public function StandardKey(Void) { //Repaint the key with 0 alpha highlight._alpha = 0; } public function onPress(Void):void { //Do the highlight animation highlightTween.stop(); highlightTween = new Tween(highlight, "_alpha", fl.transitions.easing.Regular.easeInOut, 100, 0, 10, false); } } } The errors i am currently getting are : Scene 1, Layer 'Label', Frame 1, Line 6 1120: Access of undefined property _root. Scene 1, Layer 'Label', Frame 1, Line 7 1137: Incorrect number of arguments. Expected no more than 1. If any one could help me work this out i would appreciate it very much. Kind regards Mat.

    Read the article

  • AS3 - Unloaded AVM1 swfs trace out as unloaded but memory is not freed for the AVM2 machine

    - by puppbits
    I have a large project built in as3. Part of its main functionality is to load and unload various as2 swfs. The problem is that the memory ins't free up once they are unloaded. I have access to the as2 swfs code base and destroyed all objects, stopped and killed timers, listeners, removed from stage, destroyed all the MovieClip.protoypes that were created. They look to be clean as far as the AS2 debugger show no remnants of the object after the destroy function is run. In AS3 i've closed the local connection, cleaned all references/listeners to the AVM1Movie and ran Loader.unloadAndStop(). The trace out in flex says the swf was unloaded but looking at windows task manager the memory usage never drops to when it was before the as2 swf was loaded. Each as2 swf can take up to 80 megs each time it's run so memory gets eaten up fast and loading and unloading a few as2 files. At this point if the AS2 swfs are unloaded the only thing that I can assume that could be left is MovieClip.prototype and/or _global, _root variables add during the AS2's run time. But i've gone through those and can't find anything else that might be sticking. Has anyone ever seen problems before with the AVM1 machine not freeing up its memory?

    Read the article

  • How to query an XML File with E4X in AS3?

    - by yens resmann
    I need to archive a database-driven flash as3 website. I exported a table to xml so now i have something like this: <RECORDS> <RECORD> <id>home</id> <msg>bodytext</msg> <type>0</type> <lastEditDate>0000/0/0 00:00:00</lastEditDate> <lastAccessDate>2009/6/17 11:37:21</lastAccessDate> <timesAccessed>855</timesAccessed> </RECORD> <RECORD> <id>contact</id> <msg>contact body text</msg> <type>0</type> <lastEditDate>0000/0/0 00:00:00</lastEditDate> <lastAccessDate>2010/5/6 20:40:46</lastAccessDate> <timesAccessed>831</timesAccessed> </RECORD> </RECORDS> Now I would like to select the RECORD where id is set to home. In SQL: SELECT * FROM table WHERE id='home' How can i do the same thing with E4X for AS3 ?

    Read the article

  • Is it possible to get all member variables in flash(AS3)?

    - by Parris
    Hi, I am trying grab all the member variables in AS3, and then foreach one i would like to process it in various ways. I would need the name and then if it is a collection of some type I would like to loop through that collection as well. I am attempting to essentially serialize in a somewhat custom fashion. Thanks!

    Read the article

  • How can I display image and text within one AS3 datagrid?

    - by Thomas
    The following page shows how to load external images in AS3 DataGrid: http://www.adobe.com/devnet/flash/quickstart/datagrid_pt3/ (image and text are displayed in two columns) But I wonder how the image and text can be loaded together within the same DataGrid. Within one column: Image followed by the text. I cannot get it work so I'd be grateful for any help with examples. Thanks

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >