ActionScript 3.0 :: X And Y Movement Wont Work In External Class?

Oct 21, 2009

I'm creating a small game that basically moves a movieclip around the stage using the arrow keys. I found some code on the web that worked fine but when I added it as an external class as oppose to a timeline script part of it stopped working.The script is supposed to change the appearance of the MC depending on what arrow key is pressed (this is the gotoAndStop entry in the if statement), this works fine but it is also supposed to move on the x and y but now it won't after changing to external as file. I'm stuck please see the code below.I've added the correct class name to the MC and selected the export for ActionScript, I don't get any error messages,

package{
import flash.display.MovieClip;
import flash.events.*;

[code].....

View 0 Replies


Similar Posts:


ActionScript 3.0 :: Loading External Images Won't Work Within A Class

Aug 27, 2009

I'm trying to load external images in the usual way;

Code:
loader=new Loader();
loader.load(new URLRequest(_thumb));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onLoadComplete);
private function onLoadComplete(e:Event):void{
thumb.addChild(loader);
}

But when it comes through to the onLoadComplete Function, I get a sandbox violation. I've tried using Security.allowDomain and a crossdomain.xml file, but it just won't work. Even more annoyingly, if I do the exact same thing, but within the main class file, it works fine.5 or so of these classes that need to load images are loaded from an XML file (which also works fine without allowdomain etc). Is there some sort of conflict going on because of there being more than one of them?

View 1 Replies

ActionScript 3.0 :: Using An External Class To Reference Functions From Another External Class?

Mar 25, 2010

I have a Main.fla which loads Main.as as its document class. In Main.as I have a public function named "Main" which runs a trace. I also have another .as file called Preloader.as, which also has a public function in it, this one named "Preloader" with simple trace in it. I just cannot figure out how to use Preloader() from the Preloader class in Main() from the Main class. Main.as loads up fine when the SWF loads and traces.

View 10 Replies

ActionScript 2.0 :: Using Transition Class To Do Movement

Apr 12, 2005

Check out this: [URL]. I am using the built in transition class to do the movement. I notice that when two things are clicked in quick succession the movement jitters and looks awful. Also when a menu button is clicked the little white line which appears next to it moves very slowly. I assumed this was always the case but check out: [URL] there is loads of movement going on here but no jitters on my machine.

View 4 Replies

ActionScript 2.0 :: Built In Transition Class To Do The Movement?

Apr 12, 2005

I am using the built in transition class to do the movement. I notice that when two things are clicked in quick succession the movement jitters and looks awful. Also when a menu button is clicked the little white line which appears next to it moves very slowly.

View 4 Replies

ActionScript 2.0 :: SetInterval With A Class - Function Doesn't Work Inside Class ?

Oct 7, 2004

I was wondering why my current code for calling a setInterval on a function doesn't work inside my class.I have this code inside one function, calling a second function.

intID = setInterval(selfReferential, dupe, 30, 0x000000);

The selfReferential keyword refers to the current class,but was defined previously (selfReferential = this; ).I get no errors, but the dupe() function is never called.and I had the selfReferential variable replaced with the this keyword at one point as well.

View 5 Replies

Professional :: Copying A Class - Frame 4's Class Doesn't Work?

Oct 3, 2011

I copied my actions from frame 3 to frame 4 and frame 4's class doesn't work when frame 3's class works fine and normal, here is the source code:

Frame 3: 
stop();
var rowNum:int = 10;
for (var i:int=0; i<rowNum; i++)[code]....

View 7 Replies

ActionScript 3.0 :: External Interface Call Doesn't Work With Function That Is On External JS File

Apr 17, 2012

I am using in AS3 "External Interface ". When I call the JS function that is on the same page as swf everything works fine.

I added a link in the html page to an external JS file, when I move the JS function to the external JS file the website crushes.

I would prefer to have all my JS functions on an external file so I can use them in the future in other project and it also makes it easier for me to update the site.

how to call a JS function that is on an external file from AS3?

View 6 Replies

ActionScript 2.0 :: Preloader For External Swf's - Doesn't Work For The External Movies?

May 22, 2005

... I've had my preloader successes already, but something still doesn't work for the external movies... I'm loading the main movie - which contains several chapters, loaded as external swf's - with the following preloader on the first frame, rest content from second frame on:

[Code]...

View 5 Replies

ActionScript 3.0 :: Load An External Swf If User Don't Make Any Mouse Movement?

Jul 18, 2011

How can i load an external swf if user don't make any mouse movement or click in 1 minute and when user click it shows the previous swf

View 2 Replies

ActionScript 3.0 :: End Of External Audio File Triggers Movement On Main Timeline?

Aug 12, 2011

I have a few external audio clips in MP3 format that I bring in to my SWF by creating different Sound Channels for them. However what I would like to do it when the end of the MP3 file is reached, it will dispatch an event to make the playhead on the main timeline move to a certain frame.

View 2 Replies

ActionScript 2.0 :: Circular Movement To Linear Movement - Carousel To Conveyer Belt?

Jul 9, 2010

I've been playing with carousel code, and was wondering how to change it from circular animation (carousel) to left/right linear (conveyer belt) style animation, how to change the mover code and 't.angle = i * ((Math.PI*2)/numOfItems);'

[Code]....

View 1 Replies

ActionScript 3.0 :: Creating A New Instance Fails When Base Class Is Assigned To An External Class File?

Jul 22, 2009

I'm trying to create a new instance of a MovieClip when the original one has been used. Would sound easy enough. Just use: var

instanceName:ClassName = new ClassName();

the class name/mc in the library im trying to duplicate is MCg1 so

var instanceName:MCg1 = new MCg1(); right?

However, the particular object in the library i'm trying to duplicate has a base class that is an external class file (just to control it's drag drop functionality)... i.e baseclass is not set to the standard flash.display.MovieClip, or whatever the case maybe. So i end out with a: TypeError: Error #1009: Cannot access a property or method of a null object reference.

View 6 Replies

ActionScript 2.0 :: Flowing Mc Movement Opposite Of Mouse Movement

Feb 12, 2003

I have a mc (fStrip) which looks like a piece of filmstrip with thumbnail images in it. I want this mc to move when the users mouse is positioned over it, but I only want it to move only along it's x-axis and in a direction opposite that of the mouse. And I want it to move or flow smoothly.

I've been trying to figure this out (see my lame attempt below) but without much luck.

onClipEvent (mouseMove) {
buffer=20 //movement buffer
mousePos=_root.fStrip._xmouse //store mouse position
if (mymouse!=_root.fStrip._xmouse){ //if the mouse has moved

[Code].....

View 3 Replies

ActionScript 2.0 :: Ants Movement (based On Snow Movement)?

Jun 22, 2004

I wish to get the effect of ants scuttering across the screen or up a tree, I have not decided which direction yet. I started with the tutorial code for the snow effect from kirupa, and changed it around to fit the little vector ant I created. The way I have it now looks pretty good, but the movement is a little too fluid. They obviously move in sinusoidal paths bc the code tells them to. I have about 20 copies of the main obj, and they're all a little different in size and specs (speed, transparency, etc) but what I was wondering was if there is any way I can change the code to make it a little more hectic, or erratic, not so fluid. If there is no way of doing so, it looks pretty good right now. If there is, however, I think it could look awesome. here's the code I'm using for the object.

onClipEvent (load) {
//stage
movieWidth = 850;
movieHeight = 50;

[code]....

View 5 Replies

Actionscript 3 :: Access Function In External Class Located In External Swf

Oct 22, 2011

I am trying to access a function in a loaded swf that has external class.. I would like to avoid having to put the function on my "Main" Doc class in the external swf and instead access the function directly from the class

This is what ive tried so far and it's a no dice:

private function startLoad(){
var loader:Loader = new Loader();
var req:URLRequest = new URLRequest("one.swf");

[Code]....

View 1 Replies

ActionScript 3.0 :: Loading External Swf Which Attached With Its Own External Class?

Jun 27, 2009

Lets say I have Main.swf and sub.swf, and I wanna load sub when I press a button from Main, but sub.swf has its own external class file attached, so here is the problem, when I load sub using loader class and I would get this message from the output panel:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at subScript()

seems loader class can not access sub.swf's external class when sub is being loaded.

View 1 Replies

ActionScript 3.0 :: 2D Character Movement With Camera Movement

Jun 10, 2011

how to get the camera to move with a character? At the minute he just moves off screen when i press right rather than the camera following him.

View 3 Replies

ActionScript 3.0 :: Use A Function From A Doc Class To Call A Function To Work On In Another Class?

Dec 15, 2009

how do use a function from a doc class.... to call a function to work on in

[Code]...

View 2 Replies

ActionScript 2.0 :: Set Movement Speed On Any Particular Movement?

Oct 2, 2002

I have a Mogli (Junglebook-like) Character that i got to move with the arrow keys on the keyboard.

I want the character to jump (so for example , he must while moving to the right of the "gamearea" , you must be able to hit a key (say for example the "control" key ) and then the character must jump ( go up ) and as soon as the key is released he must obviously come down.

And also how do one set movement speed on any particular movement.

View 12 Replies

ActionScript 3.0 :: Can't Get A Class To Work?

Jul 8, 2011

I'm trying to highlight some text in AS3 (ie, the text's background) and it's proving to be quite hard. I've found a class that is meant to do - search google for "AS3Text Highlighter". However, when I publish the files, I get the errors:

Code:
Scene 1, Layer 'Layer 1', Frame 1, Line 11172: Definition com.formatlos.as3.lib.text:highlight could not be found.
Scene 1, Layer 'Layer 1', Frame 1, Line 11172: Definition com.formatlos.as3.lib.text:highlight could not be found.

[Code]....

View 3 Replies

AS3 :: External Preloader Won't Work

Aug 14, 2010

I'm trying to create a preloader for a site I am creating. Originally I was going to make it an internal preloader, but I ran into that issue where the preloader doesn't start until 50% (or more). After searching these forums for a solution to "that" issue, I found it suggested that the best way to fix it is simply do an external preloader instead.

When testing the preloader using the bandwidth editor, I see that the preloader animation isn't starting now until it's at 100%, instead I simply get a white screen. Once it reaches 100% the preloader animation runs through and then...nothing. My main.swf doesn't load. It just stops.

Here is my code:

Code:
var fileToLoad:Loader = new Loader();
var fileURL:String = "testmovie.swf";
var fileRequest: URLRequest = new URLRequest(fileURL);

[code]...

preloader is my movieclip with the animation, and preloader.loading_txt is a textbox inside that mc which displays the % loaded. I wanted to make it so that once the preloader (and its animation) reach 100%, the preloader mc then plays frames 101 - 124 (which are a small transition animation into the main site). Once it reaches 124 it's supposed to call the main.swf to load.

View 1 Replies

ActionScript 3.0 :: Swf Does Not Work As An External Swf?

Oct 12, 2009

it works fine independently as a stand alone But Now i need to get it to work as an external movie swf within my main swf movie. I have managed to load it into the movie but the panning no longer works. Im guessing this problem is something to do with the levels but i have no idea what.

View 2 Replies

How To Get Preloader To Work Inside Class

Nov 6, 2009

I am very new to flash and on the net I've found a class that allows me to use a nice scroll bar for the content. My problem is that I can't get a preloader working with the class. When I want to add scrips to the frames it bugs the class if I try to implement the preloader inside the class I can't get it working. Here's the class I am using for the scroll bar. - if you want to test it, it will require additional data. You can get it all here: [URL].

package{
import flash.display.*;
import flash.text.*;
import flash.events.*;
import gs.TweenLite;
import com.warmforestflash.ui.FullScreenScrollBar;
public class Main extends Sprite{
[Code] .....

If I try to insert the preloader script inside the class it has problems with the stop(); & play(); commands. Any way to get a preferably simple preloader working with the class I am using?

View 1 Replies

Actionscript :: Php - Serialization Class Does Not Work

Jul 30, 2011

I have an actionscript class that serializes and unserializes data compatible with php's serialization functions. I expanded it to support binary data but now the unserialization does not seem to work. For example, this data is not unserialized correctly:

[Code]...

View 1 Replies

ActionScript 2.0 :: How To Work With The Event Class

Jan 5, 2007

Im trying to work with the Event class in actionscript 2.0 but its not working. Im actually working on xmlsockets. I have imported the xmlsocket library but it failed to load.

View 1 Replies

ActionScript 2.0 :: Buttons In A MC Don't Work When In A Class

Aug 24, 2010

I am attempting to delve into the world of coding and felt flash was a good place to start since I had flash 8, however I am running into a problem I just can't seem to work around.This is my project as it currently stands, you click and drag to move about, it randomly places/sizes the planets every time.The idea is to be able to click the planets and an interactive menu pop up, this menu in fact. As you can see the buttons in the movieclip are supposed to light up and things, alas they do not.I am trying to do as much as possible in classes at the moment by calling movieclips from the Library, the Planet class is what holds the planets, selection ring and menu, it looks like this:[code]I am also trying to figure out if it's possible to automatically place a number of planets based on some user input, so say if I have a text box pop up, I put 5 into that box and it places 5 planets on the screen (or in other words creates 5 variables with the planet class).

View 3 Replies

Doesn't Work When Loaded Into External Swf?

Aug 30, 2011

I've only been working with flash for about 3 weeks and I'm fairly new to programming soI'm using Flash CS5 with AS3 btw.

Code:
///////////////////////////
// Custom Mouse Controls

[code]....

View 2 Replies

ActionScript 1/2 :: Buttons Don't Work On External .swf

May 31, 2009

I have a container .swf file which takes care of loading a menu.swf and maincontent.swf.  I finally got these working together and loading at the same time, but now I ran into another problem.  None of the menu buttons work.  It loads and XML takes care of creating the buttons and adding dynamic text to them.  I also have it set up so that the mouse's hover position over the clip scrolls it horizontally (because there are too many buttons to show at once).  All of this functionality works correctly.  However, the buttons' rollovers, clicks, etc. do not register.
 
The cursor turns into the hand cursor over the entire movie clip into which the menu is loaded, and I'm assuming there is some problem with the events only targeting the clip it is loaded in, and not the buttons themselves.  It works fine when testing it by itself.  I've just recently begun working with Flash, and I learned AS3.  However, I was given pre-existing commercial software to work with which was written in AS2, and now I've converted all of my work, and this is the problem I am running into.  By the way, it seems to always come up from what I've seen, though I don't understand much about it -- _lockroot is set to true.

View 3 Replies

ActionScript 2.0 :: Buttons In External Swf Don't Work

Jan 12, 2009

I am loading an external swf in an empty movie clip in my main movie. Within the external swf are several buttons (in a scrollpane). I have this code written on a frame within a movieclip which contains the buttons:

thumb_1.onRelease = function () {
_root.gotoAndStop("big1");
}

"thumb_1" is the instance name of the button, "big1" is the name of the frame the button goes to when clicked. All of this works fine untill I bring it into my main movie. I believe the problem has something to do with the "_root." command. I think the main movie is trying to find a frame within its timeline, rather than the external swf. Know what I mean? Anyway, all I know for sure is that the buttons within my external swf don't work when loaded in my main movie.

View 5 Replies







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