ActionScript 3.0 :: Making A Complex Number Class?

Oct 28, 2009

I was thinking of making a complex number class but then realized it would be a bit of a pain to have to call functions every time I wanted to perform operations on them. Would there be any way that I could set two complex numbers like so:

Code:
var z:Complex = new Complex(-0.7, 1.4); //where the number is then -0.7 + 1.4i
var c:Complex = new Complex(1, 1.1);

and then store the result in another?

Code:
var x:Complex = z + c;

In other words, is there a way to make the +, -, * and / operators behave in ways other than those they normally would?

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Complex Shape Making Tool?

Apr 13, 2011

Does anyone know of a good tool for visually making shapes and then receiving the corresponding actionscript? To put it in context, I need to make a complex shape (a styled heart) with actionscript, but rather than going through the laborious process of trial and error with curveTo's and the like, I wanted to first see if there was already a tool out there.

View 4 Replies

ActionScript 3.0 :: Flash Complex Movie Clip As Button Class

Aug 5, 2010

I want to create a class, or classes, that will allow my designers, working in Flash Pro CS5, to call a Movie Clip from their library to be used as a button on the stage. In a perfect world they would do this with one line of code, setting the dynamic label text, the X and Y position, and setting the URL for the onClick function such as below: [code]How do I direct it to what MC I want in the Library? I am guessing it would be another parameter of the method call, but how would that work? I would like them to be able to use the code on any MC design they create.

View 1 Replies

ActionScript 3.0 :: Making An Auto-generated Class Inherit From Custom Class?

Mar 5, 2007

get a bunch of objects in my library to inherit from (or even be) one class that i have made, but without having to make .as files for every single one is this possible, or is there any other way to give objects another classes functionality in an auto-generated class?

View 3 Replies

Actionscript 3 :: Making A Random Number Divisible By 10

Mar 29, 2012

I know making a random number divisible by 10 means it isn't so random after all, but stick with me. Imagine a game grid of tiles that are 10x10 pixels. I want to place a 10x10 sprite randomly on the game grid. I've got everything working other than getting my random number function to return random numbers that are divisible by 10. If I give it a range of 10 and 50, I want it to only return 10, 20, 30, 40, 50. You know what I mean. Here's my function:

[Code]...

View 2 Replies

ActionScript 2.0 :: Making An Imported Variable ( From Php ) Into A Number

Nov 2, 2004

im importing a few variables with this [code]but now how do i make a variable say root.cash into a a number which can be used in equations or used for logical compariosons such as < > ==

View 2 Replies

ActionScript 2.0 :: Making A Random Number Generator ?

May 2, 2006

I am just making a random number generator and I have got the random numbers going using this script.

Code:
onClipEvent (load) {
go = true;
}[code]....

The only problem is that the numbers are way to fast I'd like them to be 1/2 if not 3/4 the speed that they are. how can I do that?

View 9 Replies

ActionScript 2.0 :: Making A Number Always Have 2 Decimal Places?

Jan 3, 2004

What is the Math.???? for making a number always have 2 decimal places?

View 5 Replies

ActionScript 2.0 :: Making A Imported Variable ( From Php ) Into A Number?

Nov 2, 2004

im importing a few variables with this

Code:
myVars = new LoadVars();
myVars.load("getinfo.php?user1="+userN+"&pass45="+passN+"&random="+refresh1,"0");

[code]......

View 2 Replies

Professional ::making An Interactive Game - Number Of Scenes Change Once The User Has Looked At Each Once?

Mar 19, 2010

I'm making an interactive kind of game, and I want a number of scenes to change once the user has looked at each once.For example, they go into three different scenes. When they finish looking at them all, Flash records this, and then when they look back at each scene again, they've all changed.

View 10 Replies

Flash :: Making A Debug Class?

Jun 27, 2011

I saw in some projects that ppl has their own "Debug class".So, instead of typing: trace("look at this!") you type Debug.trace("look at this!").The only advantaje I saw was that you can disable every single trace call with a single parameter in the Debug class.. but, thats all.

View 2 Replies

Making Random Graphic Generator Into A Class?

Sep 20, 2010

I have created some code that creates a blue circle of random size on the stage, and startmoving it in a random direction, at a random speed.

But I'd like to create this as a static class, so that I can just import into a banner and make multiple instances appear at a time, but my limited knowledge doesn't allow me to

Here is my code:

Code:

var child:Shape = new Shape()
var childSpeedX:Number = Math.random()
var childSpeedY:Number = Math.random()
var childDirectionX:Number = Math.random()

[Code]....

View 4 Replies

Actionscript 3.0 :: Making Instances Of A Class Aware Of Each Other?

Sep 17, 2009

I am just making the move to AS3, and in particular - moving my code to classes and packages. And right now, the penny hasnt dropped. I understand that packages group a group of related classes, but my brain just hasnt seemed to grasp a few concepts.

As a start, i thought i would port a dropdown i built in as2, to as3. The problem i am having specifically is making instances of the dropdown aware of each other. For example, I have a Dropdown Class that adds my dropdown to the stage. This class is responsible for building the dropdown, and adding the items to it.

But lets say i make another instance of this class. This brings up several issues that i dont fully understand. For example: - when one dropdown instance is open, it is the current_selected. When I open another dropdown, i want to send an event to the other instances that says "hey, if you are open you need to close" - a reset all function. Which would work similar to above. It would send an event all all instances of the dropdown class and trigger their internal "reset()" method

In as2, i would simply create some variables to keep track of these things. As far as i am aware, you can't add package level variables that instances can all see?

So, Do i need to add a customised version of the event dispatcher? and if so, how do i tie all these instances into a group of sorts.

View 7 Replies

ActionScript 2.0 :: Making A Class And Creating An Instant Out Of It?

Oct 13, 2005

i was making a class and creating an instant out of it see how it works.Here's my human class (human.as)[code].....

View 1 Replies

ActionScript 3.0 :: Making A Custom Preloader Class?

Mar 5, 2009

I am trying to build a preloader class for loading external content (images in a gallery). I have no experience in this area and I could not find many examples of making preloader classes. I was wondering if and how would it be possible to trace bytesLoaded and bytesTotal from within the preloader custom class. I was trying to pass the Loader's variable into the class and then try to trace the bytes but no luck with that.

View 1 Replies

ActionScript 3.0 :: Making A Save Game Class?

Sep 26, 2010

I am an amateur programmer attempting to make an adventure game and I need a little help. The basic setup is a panoramic engine that loads external swf's when you click on a specific area. I need a way to globally store the states of the puzzle variables so that you can save your progress.The basic idea for my save game class is as follows:

[Code]...

View 7 Replies

ActionScript 3.0 :: Flash Making A MC Class Clickable

Jan 22, 2011

In AS2 I could just do onRelease() inside the class, and all the movies would be clickable, if the class extended a MC.

This is my AS3 code, not sure why it won't work. It's like nearly impossible to Google, spent like the last two hours doing it.

Code:
package
{
import flash.display.MovieClip;

[Code].....

View 1 Replies

ActionScript 3.0 :: Making Interface - Add 'Screens' To My Current Class

Sep 3, 2011

I think I understand how to make a interface but the problem is im unsure as to how to add it to my existing code! To make a interface (as far as i know) You can create classes such as mainScreen, intructions and so on. Ok i get that, make the classes then add ther buttons from the library i these classes. But i followed a tutorial bu Emmanuel Feronto, and adapted that to the needs of my game.

So im unsure as how to add these 'Screens' to my current class, the I currently only have 1 class, Main which currently has 300 lines of code, and i dont know how to break it up into smaller classes. Thats the problem i think, The main is quite large, normally i have heard people keep this clear... But then say i made a bland main, and added the screens into that then how do i make the main that makes the game play on the play button?

View 14 Replies

ActionScript 3.0 :: Making A Circle Countdown Timer Class?

Jul 29, 2009

I am making a circle countdown timer class. It works fine, however, the startAngle variable isn't really working the way I wanted it to. It seems to start at 45 degrees even though I have it set to 0. I want it to start at the top and work it way around like a clock. So it would start at 12 and end at 12. Here is my class

Code:
// Create an instance of the class in an empty FLA
import com.ronnieswietek.utils.CircleTimer;
var counter:CircleTimer = new CircleTimer(15,0xff0000,0x000000);

[Code].....

View 1 Replies

ActionScript 3.0 :: Flash - Making MovieClip Within Class Certain Image

Feb 12, 2011

I am trying to stumble my way through learning AS3 while making a game and I would like to create a movie clip from a class but I don't want it to be a boring square, I wanna use a movieclip from the library, how would I do that?

View 2 Replies

ActionScript 3.0 :: TextAnim Class - Making Text Effects?

Nov 23, 2011

Anyone tried TextAnim? It's brilliant for making your own text effects.I am making something real simple but cannot get it to work. I am sure just pure AS3 thinkers could probably solve this without even knowing the class.I store some lines of text in an array, and each time I click the stage - the text anim kicks into do its magic on the new line of text pushed at it.here's the code - i have an instance of myTextField already on the stage

Code:
var t1:String = "This is my first line to write";var t2:String = "This is the black hole I was talking about";
var t3:String = "And now TO END WITH CAPITALS";
var txt_ary:Array = new Array(t1,t2,t3);[code].....

View 1 Replies

ActionScript :: Class Number Communication?

Mar 15, 2012

I'm a little new to AS3, but I have a question. I have a variable called "lives". It is a Number. I also have a class. It is called "Enemy". Within the "Enemy" class, there is a function called "collision_detection". How can I change the value of "lives" from "collision_detection"?

I have an Enemy class. I need to communicate from within the class to let the main program know that a collision occurred. How can I send this message to the main program?

[Code]...

View 1 Replies

ActionScript 2.0 :: Can't Access Number Var In Class

Oct 17, 2007

All I want to do is increment a counter every time a movie loads. I have a method (updateMovie) that is passed an MC and the url of the swf to load into it. My loader listener object then triggers another method that should count the number of movies loaded. For some reason I can't access my counter ('loaded').

Here is some of the code from within my class:

[AS]
private var loaded:Number = 0;
//loads passed swf into mc
private function updateMovie(mc:MovieClip, url:String) {

[Code].....

View 2 Replies

Professional :: Writing A Class For Making The 'enemies' Follow The 'player'?

Feb 14, 2011

I'm an actionscript beginner and trying  to write a class to  make the 'enemies' follow the 'player' (shown below). I'm trying to write it such that it takes two MovieClips as arguments, and moves the first one toward the second one. When I import the Class try to use it in Main.as by typing  " var followPlayer:FollowPlayer = new FollowPlayer(fishMov0, player);", I get the following error:
 
"ArgumentError: Error #1063: Argument count mismatch on jab.enemy::FollowPlayer/followPlayer(). Expected 2, got 1."

[Code]...

View 3 Replies

ActionScript 3.0 :: Making Class That Changes Mouse Cursor - Undefined Property

Dec 24, 2010

I'm currently trying to make a class that changes the mouse cursor. I made it in a new class so that I can call it again whenever I needed it, but there are some errors and I don't know how to solve it. The class filename is Cursor. This class is not linked with the fla file.

Here's the ActionScript Code:
package {
import flash.events.MouseEvent;
import flash.ui.Mouse;
import flash.display.MovieClip;
public class Cursor extends MovieClip {
public function Cursor()
[Code] .....

This class will just let me type Cursor.makeCursor(cursorMovieClip); and the cursor will change. The problem is that Flash does not recognize "addChild" and "stage". Is it because the class isn't connected to the fla? Or do I need to import some stuff in? Also, flash does not recognize "obj" in the code line
ActionScript Code:
var cursor:MovieClip = new obj;

View 8 Replies

ActionScript 3.0 :: Totally Stop A Class From Working - Making Null?

Mar 23, 2010

I have a large creation in process that requires a lot of heavy animations and movement with vectors and really processor intensive. Just want to know, regardless of whether the project is huge or small, how to totally stop a class from working? I have three classes I am calling. "class1 = new Class1();" etc. When I am in the level, say, class2, I can still talk to objects in class1 even though I removed the class listeners within that class1 after I was done using it. It still is able to be called upon, and still running something in the background that I can't figure out what it is. I just want to know, rather than searching for whatever is causing the problem, can't I simply null the class that I never ever need to use again?

I tried that, but then I ran a trace and it still tells me that it is a class object. I reckon its because I have a "public var class1:Class1" etc, which means they will always have those objects associated with them, but still. I want to totally get rid of it for garbage collection, and because I don't want to use some of them at all, ever again. So basically, what is the best way to get rid of classes so that they aren't hogging up resources any more?

View 2 Replies

Actionscript 3 ::- Extend From Number Class In Flex?

Jul 8, 2010

I need a way to "extend" or proxy the Number class in ActionScript.Basically I'll overload the toString method of it. But the Numbers should remain comparable with "<" and ">" operators.

View 2 Replies

ActionScript 3.0 :: Assigning A Number To A Public Class?

Oct 12, 2011

Here is my code:

package
{
import flash.display.MovieClip;
public class Derp extends MovieClip

[code]...

What I would like to do somehow assign a number or word variable to display one of the public classes on the screen instead of all of them at once.

View 1 Replies

Actionscript 3.0 :: Output The Value Of Number Through The Document Class?

Jun 22, 2009

test.fla has the document class test.as. This is test.as:

Code: Select all// test.as
package
{
import flash.display.MovieClip;
public class test extends MovieClip

[Code]....

Why is it so? I want to be able to output the value of number through the document class like I showed in the code of test.as above.

View 1 Replies

Actionscript 3.0 :: Document Class With N Number Of Frames

Jul 30, 2009

i'm having DocmentClass for my FLA..i'm having main movieclip inside that main movieClip i'm having n number of frames..Which is having same name called my_MC.According to the condition i'm giving gotoAndStop(1)or (2) or etc.But my Document class functionality not at all working Except 1st frame..

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved