Search Results

Search found 61 results on 3 pages for 'thedarkin1978'.

Page 3/3 | < Previous Page | 1 2 3 

  • ActionScript - Automatic containment and repositioning of object bounds

    - by TheDarkIn1978
    when adding objects arbitrarily to the stage with mouse clicks, is there a more simple way to making sure the object's bounds do not exceed those of the stage? currently i'm calling something like this before adding the object to the display list: var newSwatchRect:Rectangle = newSwatch.getBounds(this); if (newSwatchRect.x < stage.x) {newSwatchRect.x = stage.x;} if (newSwatchRect.y < stage.y) {newSwatchRect.y = stage.y;} if (newSwatchRect.x + newSwatchRect.width > stage.stageWidth) {newSwatchRect.x = stage.stageWidth - newSwatchRect.width;} if (newSwatchRect.y + newSwatchRect.height > stage.stageHeight) {newSwatchRect.y = stage.stageHeight - newSwatchRect.height;}

    Read the article

  • Event.MOUSE_LEAVE not working in AS3

    - by TheDarkIn1978
    right, so i just tossed this super simple code example into a Flash CS4 IDE frame script, but it doesn't output anything in the console. i'm simply rolling over my mouse over the window, not clicking anything, and nothing is happening. wtf?! stage.addEventListener(Event.MOUSE_LEAVE, traceMouse); function traceMouse(Evt:Event):void { trace("Mouse Left Stage"); }

    Read the article

  • ActionScript Parameter Filtering

    - by TheDarkIn1978
    i'm setting up a custom class that accepts some Number parameters, but i need to limit those parameters and would like to know the best way of doing so. currently, i'm simply calling if statements, and throwing an error if the number is above or below what's accepted. for example, there is a parameter that accepts and angle, but only between 0 and 90. in the case i've typed it as a uint so now i only have to check to see if it's above 90. there's also a parameter Number typed parameter that only accepts values between the range of 0.0 and 1.0. is my method of using if statements and throwing erros the usual way of filtering parameters?

    Read the article

  • ActionScript Binding Array Data?

    - by TheDarkIn1978
    i would like to update the numbers i've added to an array from variables, when those variables change. is it possible change these variables and have the array update automatically? var first:Number = 1; var second:Number = 2; var myArray:Array = new Array(first, second); first = 3; second = 4; trace(myArray) //outputs 1,2

    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 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 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 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

  • ActionScript - One Button Limit (Exclusive Touch) For Mobile Devices?

    - by TheDarkIn1978
    two years ago, when i was developing an application for the iPhone, i used the following built-in system method on all of my buttons: [button setExclusiveTouch:YES]; essentially, if you had many buttons on screen, this method insured that the application wouldn't be permitted do crazy things when several button events firing at the same time. problematic: ButtonA and ButtonB are available. each button has a mouse up event which fire a specific reorganization/layout of the UI. if both button's events are fired at the same time, their events will likely conflict, causing a strange new layout, perhaps a runtime error. solution: application buttons cancel any current pending mouse up events when said button enters mouse down. private function mouseDownEventHandler(evt:MouseEvent):void { //if other buttons are currently in a mouse down state ready to fire //a mouse up event, cancel them all here. } of course it's simple to manually handle this if there are only a few buttons on stage, but managing buttons becomes more and more complicated / bug-prone if there are several / many buttons available. is there a convenience method available in AIR specifically for this functionality?

    Read the article

< Previous Page | 1 2 3