Search Results

Search found 2242 results on 90 pages for 'actionscript 3'.

Page 16/90 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Switching back into the middle of a function in Actionscript

    - by J.Ded.
    I need to return to my original function after capturing an event (downloading something) with another function. The original function needs to return a value, which depends on the downloaded data. So, I'd like to pause original function for the time needed for the download and the eventhandler function to complete it's work, and resume it afterwards. The obvious way is to set a flag value (both the original function and the eventhandler are within the same class) and make the original function check it until the eventhandler function changes the flag. But that would be wasteful, and my AS is slow enough already:) [other parts of the application utilise some heavy graphics]. Is there another way? Like an event that gets captured "in the middle" of the function? Or some other form of flow control?

    Read the article

  • ActionScript Reading Static Const Array

    - by TheDarkIn1978
    how can i evaluate weather my test array is equal to my static constant DEFAULT_ARRAY? shouldn't my output be returning true? public class myClass extends Sprite { private static const DEFAULT_ARRAY:Array = new Array(1, 2, 3); public function myClass() { var test:Array = new Array(1, 2, 3); trace (test == DEFAULT_ARRAY); } //traces false

    Read the article

  • ActionScript Defining a Static Constant Array

    - by TheDarkIn1978
    is it not possible to define a static const array? i would like to have an optional parameter to a function that is an array of colors, private static const DEFAULT_COLORS:Array = new Array(0x000000, 0xFFFFFF); public function myConstructor(colorsArray:Array = DEFAULT_COLORS) { } i know i can use ...args but i actually wanting to supply the constructor with 2 separate arrays as option arguments.

    Read the article

  • ActionScript Custom Class With Return Type?

    - by TheDarkIn1978
    i just know this is a dumb question, so excuse me in advance. i want to essentially classify a simple function in it's own .as file. the function compares integers. but i don't know how to call the class and receive a boolean return. here's my class package { public class CompareInts { public function CompareInts(small:int, big:int) { compare(small, big); } private function compare(small:int, big:int):Boolean { if (small < big) return true; else return false; } } } so now i'd like to write something like this: if (CompareInts(1, 5) == true). or output 'true' by writing trace(CompareInts(1, 5));

    Read the article

  • actionscript find and convert text to url

    - by gravesit
    I have this script that grabs a twitter feed and displays in a little widget. What I want to do is look at the text for a url and convert that url to a link. public class Main extends MovieClip { private var twitterXML:XML; // This holds the xml data public function Main() { // This is Untold Entertainment's Twitter id. Did you grab yours? var myTwitterID= "username"; // Fire the loadTwitterXML method, passing it the url to your Twitter info: loadTwitterXML("http://twitter.com/statuses/user_timeline/" + myTwitterID + ".xml"); } private function loadTwitterXML(URL:String):void { var urlLoader:URLLoader = new URLLoader(); // When all the junk has been pulled in from the url, we'll fire finishedLoadingXML: urlLoader.addEventListener(Event.COMPLETE, finishLoadingXML); urlLoader.load(new URLRequest(URL)); } private function finishLoadingXML(e:Event = null):void { // All the junk has been pulled in from the xml! Hooray! // Remove the eventListener as a bit of housecleaning: e.target.removeEventListener(Event.COMPLETE, finishLoadingXML); // Populate the xml object with the xml data: twitterXML = new XML(e.target.data); showTwitterStatus(); } private function addTextToField(text:String,field:TextField):void{ /*Regular expressions for replacement, g: replace all, i: no lower/upper case difference Finds all strings starting with "http://", followed by any number of characters niether space nor new line.*/ var reg:RegExp=/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; //Replaces Note: "$&" stands for the replaced string. text.replace(reg,"<a href=\"$&\">$&</a>"); field.htmlText=text; } private function showTwitterStatus():void { // Uncomment this line if you want to see all the fun stuff Twitter sends you: //trace(twitterXML); // Prep the text field to hold our latest Twitter update: twitter_txt.wordWrap = true; twitter_txt.autoSize = TextFieldAutoSize.LEFT; // Populate the text field with the first element in the status.text nodes: addTextToField(twitterXML.status.text[0], twitter_txt); }

    Read the article

  • ActionScript Negating a Number

    - by TheDarkIn1978
    i'd like to negate a number and would like to know if there's a built in method that will convert a negative number to a positive OR a positive into a negative, depending on the number. i know about Math.abs(), but that only seems to convert negative into positive. is there a method that will do both?

    Read the article

  • Problems with capturing an event in child object in Actionscript

    - by Raigomaru
    I have two classes. The first one (the starting class): package { import flash.display.Sprite; import flash.events.KeyboardEvent; import tetris.*; public class TetrisGame extends Sprite { private var _gameWell:Well; public function TetrisGame() { _gameWell = new Well(); addChild(_gameWell); } } } The second: package tetris { import flash.display.Sprite; import flash.events.KeyboardEvent; public class Well extends Sprite { public function Well() { super(); addEventListener(KeyboardEvent.KEY_DOWN, onKeyboard); } private function onKeyboard():void { //some code is here } } } But when I press any buttons on my keyboard, the child class Well doesn't have any reaction. What's the problem?

    Read the article

  • && operation in actionscript

    - by wcpro
    In the following code the line after the if statement gets run even when "BITMAP" is null. Why is this? public function get BitmapHeight () { if (_bitmapHeight == 0 && BITMAP != null) _bitmapHeight = BITMAP.bitmapData.height; return _bitmapHeight; }

    Read the article

  • determining the starting speed for an accelerated animation (in flash/actionscript but it's a math question)

    - by vulkanino
    This question burns my brain. I have an object on a plane, but for the sake of simplicity let's work just on a single dimension, thus the object has a starting position xs. I know the ending position xe. The object has to move from starting to ending position with an accelerated (acceleration=a) movement. I know the velocity the object has to have at the ending position (=ve). In my special case the ending speed is zero, but of course I need a general formula. The only unknown is the starting velocity vs. The objects starts with vs in xs and ends with ve in xe, moving along a space x with an acceleration a in a time t. Since I'm working with flash, space is expressed in pixels, time is expressed in frames (but you can reason in terms of seconds, it's easy to convert knowing the frames-per-second). In the animation loop (think onEnterFrame) I compute the new velocity and the new position with (a=0.4 for example): vx *= a (same for vy) x += vx (same for y) I want the entire animation to last, say, 2 seconds, which at 30 fps is 60 frames. Now you know that in 60 frames my object has to move from xs to xe with a constant deceleration so that the ending speed is 0. How do I compute the starting speed vs? Maybe there's a simpler way to do this in Flash, but I am now interested in the math/physics behind this.

    Read the article

  • ActionScript arrays being automatically set to other values

    - by nababa
    I am making a flash game, in each round, the player will chose either True or False. The decision of each round will be stored in an array. That is, it looks like {true, false, true, false}.. When the user clicks the "Debrief“ button, the eventlistener will be called and the game will go to the debriefing part. It will read the array mentioned before. However, the array values are all "false". I am very sure that the array has not being touched in between. So, any ideas about why the array is set to false mysteriously?

    Read the article

  • Actionscript 3.0 Get all instances of a class?

    - by Windbrand
    I got a ton of movieclips in a class. Is there a more efficient way to apply a function to every instance in the class other than this? var textArray:Array = [ interludes.interludeIntro.interludeBegin1, interludes.interludeIntro.interludeBegin2, interludes.interludeIntro.interludeBegin3, interludes.interludeIntro.interludeBegin4, interludes.interludeIntro.interludeBegin5, interludes.interludeIntro.interludeBegin6, interludes.interludeIntro.interludeBegin7, //... ... ... interludes.interludeIntro.interludeBegin15 ]; for each (var interludeText:MovieClip in interludeBeginText) { interludeText.alpha = 0 //clear all text first } Also for some reason this doesn't work: interludes.interludeIntro.alpha = 0; It permanently turns that class invisible, even if I try to make specific instances visible later with: interludes.interludeIntro.interludeBegin1.alpha = 1; I have NO idea why the above doesn't work. I want to turn every single instance in the class interludeIntro invisible, but I want to turn specific instances visible later. (btw I have no idea how to insert code on this website, pressing "code" doesn't do anything, so pardon the bad formatting)

    Read the article

  • Default parameters in ActionScript 3.0

    - by camusgroup
    I have a function, for example function test(p1:int=7,p2:Boolean=true,p3:uint=0xffff00,p4:Number=55.5) { //instructions } How to change only p4, for example, and parameters p1,p3,p3 was still default? Next time I want to change for example only p2, and parameters p1,p3,p4 was still default? etc.

    Read the article

  • ActionScript 3 - access variables in main application class from instantiated class

    - by Herter
    I have a initApp.as which instantiates a class which needs to access the "currentState" property and the States array as well. However we cannot get this to work as we cannot see how we can access this information. Within initApp.as currentState is accessed via "this.currentState". This does not work in the class which is instatiated within initApp.as. The following error is thrown: "Access of undefined property currentState." Anyone know how this can be solved?

    Read the article

  • create variable from array actionscript 3

    - by steve
    I'm currently trying to make a dynamic menu via an array and a loop. So when someone clicks on the first item of the array, "menu_bag_mc" it will link to the content "menu_bag_mc_frame" (or some name that will be unique to this array) that is another movieclip that will load. Below is the code I have so far: //right here, i need to make a variable that I can put in the "addchild" so that //for every one of the list items clicked, it adds a movieclip child with //the same name (such as menu_bag_mc from above) with "_frame" appended. //I tried the next line out, but it doesn't really work. var framevar:MovieClip = menuList[i] += "_frame"; function createContent(event:MouseEvent):void { if(MovieClip(root).currentFrame == 850) { while(MovieClip(root).numChildren > 1) { MovieClip(root).removeChild(MovieClip(root).getChildAt(MovieClip(root).numChildren - 1)); } //Here is where the variable would go, to add a child directly related //to whichever array item was clicked (here, "framevar") MovieClip(root).addChild (framevar); MovieClip(root).addChild (closeBtn); } else { MovieClip(root).addChild (framevar); MovieClip(root).addChild (closeBtn); MovieClip(root).gotoAndPlay(806); } } Is there a way to make a unique variable (whatever it is) from the array so that I can name a movieclip after it so it will load the new movieclip? Thanks

    Read the article

  • ActionScript 2, list of nested movieclips

    - by vyger
    Hello, has anyone ever tried to get the list of all the movieclips (even the nested ones) that are on Stage at a specified stopped (and current) frame in Flash 8, AS 2? I did the following: for(i in _root){ if(typeof(_root[i])=="movieclip"){ trace(_root[i]);} } But this is good for a first level search: that is, if inside the movieclips you have other movieclips, you can't reach them. Furthermore, inside a movieclip there can be more then one movieclip. Has anyone ever tried to do what I'm trying to do? Bye!

    Read the article

  • red5 actionscript

    - by massi
    Hi all, How to get a parameter encode in the url ? for exemple, if we have an html file containning : how to get the value of a from application.java class ? Thanks

    Read the article

  • ArgumentError: Error #2015: Invalid BitmapData.

    - by numerical25
    I am having problems loading a bitmapData. I am getting the following error Engine Init //trace loadimage//trace ArgumentError: Error #2015: Invalid BitmapData. at flash.display::BitmapData() Below is my code. it appears it happens after the trace loadimage package com.objects { import flash.display.Sprite; import flash.display.BitmapData; import flash.display.Bitmap; import flash.geom.Point; import flash.geom.Rectangle; import flash.display.Loader; import flash.net.URLRequest; import flash.net.*; import flash.events.*; import flash.display.LoaderInfo; public class gameObject extends Sprite { protected var w:Number; protected var h:Number; protected var image:BitmapData; protected var canvas:Bitmap; protected var px:Number; protected var py:Number; public function gameObject():void { init(); } private function init():void { } public function loadImage(imageDir:String, w:Number, h:Number, px:Number, py:Number):void { this.w = w; this.y = y; this.px = px; this.py = py; trace("loadimage"); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,imageComplete); loader.load(new URLRequest(imageDir)); } private function imageComplete(e:Event):void { var loader:LoaderInfo = LoaderInfo(e.target); image = Bitmap(loader.content).bitmapData; drawImage(); } private function drawImage():void { var tilePoint:Point = new Point(0,0); var tileRect = new Rectangle(py,px,w,h); trace(loader.content); var canvasData:BitmapData = new BitmapData(w,h); trace("got canvas data"); canvasData.copyPixels(image,tileRect,tilePoint); trace("copied pixels"); canvas = new Bitmap(canvasData); } } } And my call the the method is like so balls = new Array(); balls[0] = new gameObject(); balls[0].loadImage("com/images/ball.gif", 15,15,0,0); When I trace the Loader.content, below is what shows Engine Init loadimage [object Bitmap] ArgumentError: Error #2015: Invalid BitmapData. at flash.display::BitmapData()

    Read the article

  • Calling WCF Service from Action Script 2

    - by Frank
    Hi All, I am a .NET programmer working with a Flash designer on a project. The design is that they will create a flash UI (implemented with AS2) to present a questionnaire. After it is completed by an end user, the will send me (a .net web service of some form) the answers to the questionnaire, I will perform a calculation, and I will send a response back (the response will likely be a single integer, though it may be a touple of (integer score, string description). Neither myself nor the designer is knowledgeable of Action Script. Does anyone have a snippet for such web service calls in AS2? Are there any soap libraries for AS2 that we could use, or should I expose a RESTful interface? Can it be as simple as having the designer concat the questionnaire answers into the query string of the service URL? What would be a typical data format for my response (xml, json, plain text) Thanks in advance for your help. Frank

    Read the article

  • Determine if getPixel() value is greater than or less than 50% gray

    - by cmal
    I am trying to loop through a bitmap and determine if each pixel is lighter or darker than gray using getPixel(). Problem is, I am not sure how to tell whether the value returned by getPixel() is darker or lighter than gray. Neutral gray is about 0x808080 or R:127, G:127, B:127. How would I need to modify the code below to accurately determine this? for (var dx:int=0; dx < objectWidth; dx++) { for (var dy:int=0; dy < objectHeight; dy++) { if (testBmd.getPixel(dx, dy) > GRAY) { trace("Lighter than gray!"); } else { trace("Darker than gray!"); } } }

    Read the article

  • Disable rows in Flex DataGrid

    - by Christophe Herreman
    Unless I'm missing something obvious here, there is no way of disbabling one or more rows in a DataGrid. I would expect a disabledRows or disabledRowIndidices property on the DataGrid or List component but that doesn't seem to exist. I found a "rendererArray" property which is scoped to mx_internal and contains all itemrenderers of all cells in the datagrid. So I can check the type and the value of the data inside the renderer and enable or disable all cells of the same row, but that feels too much like a hack. Any suggestions? Edit: I realize that disabling a row could mean different things. In my case it means not being able to edit the row even when the editable property of the datagrid is set to true. It could however also mean not being able to select a row, but that's not what I'm looking for.

    Read the article

  • Settings for RTMP and AS 3.0

    - by coderex
    Hi, Is there any extra code need for using rtmp with AS3. I have the code like this. Is that enough for rtmp or any other code needed? var strSource:String = "rtmp://myserver.com/file.flv"; var ncConnection = new NetConnection(); var nsStream = new NetStream(ncConnection); nsStream.play(strSource);

    Read the article

  • flashplayer for my website.

    - by MaNa
    hey everyone. Lets assume i got 3 .flv files in a folder. How can i create a flashplayer which can read the amount of .flv files from that folder and play them. And if example, i add 2 more videos to that folder, the flashplayer will detect them too, and play them chronologically after the name, date, etc.. ?? just need some guide or maybe links which explain how to do this? tnx in advance.

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >