Questions tagged [actionscript-3]

Adobe ActionScript 3 is the open source object oriented programming (OOP) language of the Adobe Flash and Air Platforms. AS3 is widely used for RIAs, mobile apps, and desktop applications. (ActionScript 3 is a dialect of ECMAScript.)

Filter by
Sorted by
Tagged with
15 votes
2 answers
266 views

UltimateTicTacToe - ActionScript Style!

In an effort to complete this month's code challenge, I've started off with the basics. Below I have for review, a class that I can call to create the square/button a user would click to mark a spot ...
8 votes
2 answers
61 views

Reading code from array efficiently

I'm trying to read data from an array. I manage to get the information I want but my code is extremely inefficiently written. My array looks like this: ...
5 votes
0 answers
272 views

2D Game - Ray-cast collision handling

This code is an excerpt from an infinite platformer I'm working on for fun. It belongs to the class GameObject from which every object i.e platforms, player, ...
1 vote
1 answer
30 views

Add and remove Tiles during pan event for 4 directions

This function accepts a String (either "right", "left","up", or "down") to do 4 similar but different things. I'd like a more elegant solution to this problem. I sense that there is one, but I can't ...
4 votes
1 answer
292 views

Enumerations via reflection in AS3

I'm very much used to enumerations a la Java, where each value in an enum is a distinct object. You can call functions on these objects, and they're generally ...
3 votes
0 answers
54 views

Scrolling 2D Tiles

update: So, this is weird, I just reinstalled Adobe Animate, and now, when I do ctrl+enter (test movie), it pulls up an AIR window, and plays my app, and it works smooth as butter! (now I'm just not ...
3 votes
1 answer
450 views

Is there anything wrong with this double ternary?

Is there anything wrong with using double ternary operator like so: ...
6 votes
1 answer
138 views

Weighted choices

Is there a more efficient way to do the below without two for loops in actionscript 3? In java there is NavigableMap or something like that where dont need to loop. ...
1 vote
1 answer
51 views

Input field that dynamically monitors model value

This question is regarding my approach to the following implementation requirement. Can you suggest a better alternative that doesn't suffer from the issues I'll point out in my implementation? ...
9 votes
1 answer
529 views

Date range validation

The following code is ran when the user presses a button to generate a log file based on the date selected. The DatePicker has a restrictive selected date range of ...
2 votes
1 answer
41 views

Creating error messages for grammar mistakes - avoiding duplication when refactoring

After my Dialogue parser has parsed a dialogue, it needs to be validated. To that end, I have several checker classes that go through the lines of the Dialogue. These checker classes get huge as I ...
1 vote
1 answer
327 views

Fruit game using nape physics with refactoring to Builder Pattern

I am doing a game that uses nape physics in ActionScript, but my question isn't about language. It is about the use of patterns. I had fruits in my game. I did one interface ...
5 votes
3 answers
656 views

Frogger game in Actionscript 3

I am creating a Frogger game in Flash AS3 and just wanted to see if anyone can help me improve it without breaking the game. The reason I ask for it because I don't have any errors, but I do get over ...
3 votes
1 answer
383 views

Actionscript Graph data structure implementation

So, I am not sure if I should have Vertex extend Point, because the equals() and ...
3 votes
1 answer
84 views

Parsing a Dialogue Script - fixing my 620 line mess

Given a Dialogue Script for SDT (NSFW! Google at own risk), parse said dialogue script for validation with checkers. A dialogue script consists of a set of lines. There's a special line, ...
3 votes
1 answer
474 views

Do I need to remove these event listeners?

The following ActionScript code just downloads and attempts to parse some JSON from an API service. Inside the method I have defined a cleanUp() function, just to ...
10 votes
2 answers
277 views

Simon-says in AS3 - Prototyping functionality

My non-serious entry for Simon Says. Based on literal interpretation of the rules: Create a UI with four colored buttons that light up in a random pattern. After displaying the pattern, the player ...
3 votes
1 answer
807 views

Preload content in StageWebView

I would like to get some feedback on my AS3 code below. It's for an Adobe Air mobile app to preload a website in a StageWebView container. That container will be moved on screen later in the app ...
3 votes
1 answer
171 views

AS3 AIR class robustness check

I have a ActionScript 3 AIR class that I'd like you to check for robustness. I know it's quite a lot of code and It's not required that you review the full code, but maybe you see general problems in ...
2 votes
1 answer
115 views

Efficiently consolidating an array of objects

In my program, I'm getting Facebook objects and using temp to display on a separate screen how many unread messages they have. However, we have since decided to ...
1 vote
1 answer
351 views

Unit tests for collisions

I'm finding it a bit tedious to write unit tests for my collision class because there are so many variations of collisions that need testing. I see repetition in the set-up and assertion stages of ...
3 votes
2 answers
137 views

Game character sprite positioning and movement

The player will have different spells that can be cast on different keyboard key combinations. Right now what I have is one .as file with everything on it. A bunch of ...
11 votes
1 answer
1k views

Case-insensitive String search in Array

Wrote this function for a Stack Overflow answer. It started off pretty bad but in the end I polished it a bit and now I have something I think to be pretty clean. Actually, when I look at the code, ...
4 votes
2 answers
218 views

Using Booleans to Manage State

I'm in the middle of writing my own little bullet shooter game much in the style of Touhou. Everything works fine so far but I'm disliking certain aspects of my code. Take this function for showing ...
5 votes
1 answer
398 views

Actionscript web service and web method call classes

I'm trying to isolate a webservice in its own class, and I plan to add separate classes to each webmethod there is in the webservice. What I have so far works, but I have this feeling tickling that I'...
10 votes
1 answer
279 views

Making a square move counter-clockwise around the edge

This is so ugly code. There must be better way to write it, but I'm noob to AS3. The goal is to make a square move at even speed counter-clockwise around the edge and on call ...
10 votes
1 answer
154 views

Key Press Handler

I have made a class to import into my projects to more easily handle the state of the keyboard so I can use stuff like: if(Keys.returnKey(37)){ As opposed to ...
4 votes
1 answer
92 views

Simple expense tracker

I have posted below a small project of mine in AS3 regarding a super simple Expense Tracker. I finally made it basically functional, and I learnt A LOT in the way. But even I can tell that my design ...
0 votes
2 answers
76 views

PRNG - Algorithm: Performance vs Readability

I have a PRNG-Algorithm: ...
1 vote
1 answer
62 views

Seeding a PRNG - Custom Setter

I have a PRNG-Class called Generator. Now, after creating a new instance of it: var g:Generator = new Generator(); Custom ...
7 votes
1 answer
2k views

Getting and setting a static variable

...
4 votes
1 answer
323 views

Getting better speed from adjusting rows in a DockableToolBar

I've been using FlexLib for its dockable toolbar feature. When you shrink the window, it will try to wrap rows if the stage width is less than the row width. Unfortunately, it won't reverse the ...
4 votes
1 answer
51 views

Character Sprint Spaghetti Code

I finally managed to get the code to work properly. It makes the player object move faster if the user double taps the arrow key with a few 'ticks' (new frames) after the 1st stroke. - User presses ...
3 votes
1 answer
362 views

More efficient way to write this Actionscript 3 class?

I wrote one of my first classes in Actionscript 3 and I want someone versed in AS3 to help me fine tune my class. I am sure there are things that could really help with efficiency and I love learning ...
3 votes
10 answers
3k views

How to simplify my else if statement

Alright so this isn't an issue with my program not working, it's more of a fact that I wanna learn to code better. This is one of 6 if else statements that I use inside of my program. What I'm ...
1 vote
1 answer
82 views

Passing lots of options to a function

I am learning actionscript 3 coding by making a crappy platformer game :) The problem I am facing is passing lots of options to a construct function that will setup the display object where all of ...
0 votes
1 answer
131 views

Actionscript 3.0, good OOP?

I have been coding for some time (3 years I think), and have recently been wondering if my coding pattern is any good. Any kind of feedback is welcome: EDIT: The thing that concerns me most is that I ...
2 votes
2 answers
175 views

Is there anything biased in this performance test?

Just wondering if this basic performance test between an untyped array of arrays and a vector (typed array) of arrays in Actionscript 3... is fair and balanced? It's simple, designed to test random ...
3 votes
2 answers
240 views

Add events dispatching for ActionScript framework Robotlegs

I have the following function in a Service class ...
1 vote
2 answers
146 views

Is this possibly confusing code?

A previous developer had an array of strings like so: ...