ActionScript 3.0 :: Code Conflict With Document Class?

Aug 14, 2010

the first code (which I put into a frame) is somehow in conflict with my document class.I get these error messages:

1046: Type was not found or was not a compile-time constant: URLRequest
1180: Call to a possible undefined method URLRequest.
1180: Call to a possibly undefined method navigateToURL

But when I only use that code and unlink the document class it works. So there must be somehow a conflict between the two, but I have no idea how to integrate this code into my document class -I already tried it but the error messages keep coming, probably I didn't do it right.

code in frame:

Actionscript Code:
btn_contact.addEventListener(MouseEvent.CLICK, contactClickHandler);function contactClickHandler(event:MouseEvent):void {    var url:URLRequest = new URLRequest("../Subpages/SubpageContact.html");    navigateToURL(url, "_top");}

[CODE]....

View 1 Replies


Similar Posts:


ActionScript 3.0 :: After Moving Code From The Fla To Document Class?

Apr 28, 2009

This is the file before the move [URL]...  when you click the contact us button it should dissolve now I get:

ArgumentError: Error #2005: Parameter 0 is of the incorrect type. Should be type IBitmapDrawable. at flash.display::BitmapData/draw()at WebSite/$construct/gotoContact()[C:AS3projectsfullBrowserscaleVid WebSite.as:65]

here's the code: the offending code is in bold everything but the pixel dissolve works as before com is the instance of flvPlayback component that's on stage at author time there is nothing else on stage at author time and no action script in the flv

[Code]...

View 4 Replies

ActionScript 3.0 :: Converting Code From A Document Class

Feb 15, 2011

This will probably seem a moronic question, but I've only been using Actionscript for about a week... Either way, I've written a very long and complicated (8500 lines w/ autoformat) code for a game I've decided to program. The game is functional, the AI can respond to outside inputs etc, and I know reasonably well how to use SharedObjects.

What I'd now like to do is make a menu system surrounding my game that can pass variables in and out of this existing program. The program is currently in the shapely form of a Document Class, meaning the code runs on load. I'd prefer if there was a way to simple make the code run upon being called. How would I best do this? The only inputs presently used are keyboard inputs...

View 3 Replies

ActionScript 3.0 :: Combining Document Class With Timeline Code?

Jan 6, 2010

I've written a game in Flash using timeline code like this:On the main timeline:

Code:

stop();
include "includes/mySourceCode.as";
init();

Then,in mySourceCode.as I have a set of functions (including init(), of course).I know this technique of coding is frowned upon by many,but it was what I learned when I started out with Flash and it has always worked well for me. It also means I don't usually have to bother with importing classes to make most methods work as I guess they are all 'built in' to the main timeline already.

The problem I have now is that I have got the game sponsored, and the sponsor needs me to include his preloader, which is a document classfile.So I have his preloader working, and once loaded it tells the main timeline to proceed to the next frame, where I have my usual code as above - which now doesn't work.Firstly, it can't find my include files because it is now looking in the document class folder instead of the main .fla folder it usually looks in.Secondly, once I have moved my include files to the same folder as the document class, it gives me around 70 errors about undefined properties and methods, and things not being'compile time constants' whatever that means.

I am guessing that for some reason, since there is now a document class, Flash is no longer importing all the classes it usually does automatically for me - so could it be that I need to go through my whole game and figure out the class import paths for all the methods I have used? Or is there an easier way to get my code working how it was before without having to change it? If I do impoort all the right classes, should it work then or will I still face problems?

View 2 Replies

ActionScript 3.0 :: Document Class Vs Timeline Code Differences

Nov 21, 2010

I'm trying to hunt down some kind of class conflict I seem to be having when using TweeLite easing and found out the same code that errors in a document class works fine if I place it in the timeline. Example - this works in frame one of the timeline:

[Code]...

View 9 Replies

Flash :: Differences Between Code In The Timeline And Using A Document Class?

Mar 9, 2011

I had some code directly in the timeline that accessed/modified properties of some movie clips.
I then did the proper thing and moved the code to a Document class. I put the code that was formerly in the timeline into the document class constructor.

The issue I'm having is that if I access the movie clip properties "too soon" it reports that they are null. If I put the code in a timer event callback for half a second or so, or put an addFrameScript call with a frame of around 8 or higher, the movie clip references are valid and it all works.

So for some reason by the time the code in the timeline gets called all of the movie clip instances are valid. However, when inside of a document class constructor, they are not. I've tried using the ENTER_FRAME event callback but the movieclips still aren't ready.

The code is supposed to change some movie clip properties based on some loaderinfo parameters, so I do kind of need to set those properties before anything starts animating.

View 1 Replies

ActionScript 3.0 :: Delay Constructor Code In Document Class?

Jul 20, 2011

I'm learning how to work with a document class. Using the class below, I am learning that this initiates immediately when running the Fla. The problem is that the "scrol" Movieclip is not present in the first frame, which is a menu with a list of topics. Scrol comes later in and is in it's own section/frame label and goes to that section when selected from the main menu of topics.

Is there a way I could call this action only when the Movieclip is present or when that section is shown? Also, I'd like to apply it to other movieclips, not just scrol. Underneath se = new SwipeEngine(scrol,400,0); can I just add a duplicate line but change the mc name? A possible concern is that the mcs may be different sizes in length and might not need to scroll as far.

[Code]....

View 3 Replies

ActionScript 3.0 :: Children Swf Timeline Code Versus Document Class?

Nov 23, 2010

I am trying to find out why when I place trace(parent); in the timeline of my child swf I get [object Loader]but if i place  trace(parent); in the constructor of the child swf's document lcass I get null.Why is this and how would I access the parent swf  from the child document class if it shows as null?

View 2 Replies

ActionScript 3.0 :: Moving Code From Timeline To Document Class Error 1067

Nov 25, 2011

coder dudes I need help on some actionscript 3. Im trying to move a piece of code from the timeline into the document class. Here is the timeline code:
 
import Memory.MemoryGame; 
// Add memory game
var memoryGame:MemoryGame = new MemoryGame(this, "settings.xml");
 
Here is my attempt at moving it into the Document class:

[Code]...

View 17 Replies

ActionScript 3.0 :: Flash Variables Between Frames - Put All Code From The Main Timelime To A Document Class?

Feb 6, 2011

I have a little problem in my game. I have a var coins:int = 0; on frame one, and I want to access it from frame 2. I'm not using a document class. Is it possible to make some kind of a global variable like in as2 without having to put all my code from the main timelime to a document class?

View 1 Replies

ActionScript 3.0 :: Flash - Dispatching An Event From One Document Class And Listening For It Via Another Document Class?

Dec 14, 2010

I am dispatching an event from one document class and listening for it via another document class.My code in class A.

Code:
this.dispatchEvent(new MYEvent(MyEvent.APERTURE_DONE));
trace("Dispatching APERTURE_DONE");

my code in class B.

Code:
addEventListener(MyEvent.APERTURE_DONE, onDoorsOpen,true);
trace("Lisetning for APERTURE_DONE");

[code]....

My listener is registering before the event is dispatched, based on my output window, however I never get the "Open Doors" trace statement to fire.

View 2 Replies

ActionScript 3.0 :: Reference Main Document Class From Document Class Of Loaded Swf

May 7, 2011

I have a FLA (say Main.FLA) document class with a child MovieClip on the stage: into the child MovieClip I load other swf files: each of the files contains its own Document Class (every swf is a somewhat independent application, say quizzes and so on).For some reason I must use the Main document class to store data (scores or so) from the child swfs loaded into the Main swf. HOW do I reference the Main class? I can't find a way.[code]and dispatch an Event this way from the loaded swf document class to the Main class:[code]Now, first of all I don't know if this could even work. Secondly, I tried to make it work by adding an event listener to my Main class but id did not work.

View 9 Replies

ActionScript 3.0 :: Moving Document Class .fla Cannot Find The Document Class - WTF?

Sep 22, 2008

So I had a working .fla, with a document class package in the same directory. Everything was fine, until moving both to a new directory, now the fla cannot find the document class. WTF?

View 2 Replies

ActionScript 3.0 :: Using Loadmovie - Get The Error Code : 1151: A Conflict Exists With Definition Loader In Namespace Internal?

Jun 26, 2008

i dont know if its me but have things got alot more complicated? i have made 4 .swf's that all work fine individually. i have 4 scenes that each .swf is to load into and play in turn when the main movie loads in.before the loadmovie code was:

stop();
unloadMovieNum(2);
loadMovieNum("fcbp01.swf", 2);

now however i have been advised to use:

var request:URLRequest = new URLRequest("achange.swf");
var loader:Loader = new Loader();
loader.load(request);
addChild(loader);

this does not work and i get the error code: 1151: A conflict exists with definition loader in namespace internal.var loader:Loader = new Loader();.

View 3 Replies

ActionScript 3.0 :: Conflict On Using The Same Base Class

Mar 30, 2010

I'm creating an application with an animated kid figure. All the kid symbols sit in a kidLibrary.Fla file, Each of these symbols have a class named "Kid" linked to it on its Properties >Base Class. This Kid class is responsible for setting the right color and hair type for each kid symbol instance. Every time i need to include one of these kid symbols i drag it to the current .fla file I'm working on. If I place only one kid symbol in the library of the file I'm working on, everything works fine!

Now here is the problem: When i place more than one kid symbol in the library, and then drag it to the stage, then one of the symbols works fine while the other one doesn't seem to access all the properties of the Kid base-class. The result is that only one symbol act perfect while the other one(s) not.

[Code].....

View 5 Replies

Actionscript 3 :: Naming Conflict : Same Method Name In Inherited Class And Interface?

Feb 8, 2012

public class A extends B implements C {
}

Class B and interface C have the same member function name(not the same signature).This code can't be compiled. How can I solve this?

View 2 Replies

ActionScript 3.0 :: Conflict With Panel Class Since The Enlargement Doesn't Occur Whenever The Image Pivots

Dec 21, 2009

I'm building my portfolio in as3 with a 3D panel effect with a class called panel taht i get as my main class in my the publish window. This class uses GS tweening class ton rotate on a 3D axis and to enlarge the pictures from my portfolio all this is working relatively well. Now i got an image to also turn 90 dergees for it is horizontal image nd the gallery has vertical thumbnails so i just coded this simple function to make it flip with GS of course

[Code]....

View 1 Replies

Actionscript 3 :: Flash CS5 Reference A Display Object From A Class Other Than The Document Class

Jul 28, 2011

Using Flash CS5 Professional I have created a symbol, dragged it onto the stage, and given it an instance name of GreenLight1. If I want to make this visible from the document class, I can simply do the GreenLight1.visible=true; and poof it's good to go when I test the file. As long as I stay in the document class I am good to go, but now I'm trying to move to another class and hitting ALL kinds of trouble just trying to get Flash to allow me to access this simple object. All I am looking to do is have this GreenLight1 go invisible (visible=false) when a certain condition occurs in this new class and Flash just won't let me access GreenLight1 at all. Things I've tried thus far:

stage is passed to the class and is referenced by _stage and is working just fine when I do _stage.addchild or anything like that. So I have tried "_stage.GreenLight1.visible=false;" and I get "ReferenceError: Error #1069: Property GreenLight1 not found on flash.display.Stage and there is no default value." My document class extends Sprite, so I figured I'd try the root function. So I tried "Sprite(root).GreenLight1.visible=false;" and I get "1119: Access of possibly undefined property GreenLight1 through a reference with static type flash.display:Sprite." I tried to create the Resource class as described therein. To which I came across the same problem that I started with in that it doesn't know what GreenLight1 is to begin with so I got "1120: Access of undefined property GreenLight1." Here is my code for Resource.as (am I supposed to pass something to this class from the document class?)

[Code]...

View 2 Replies

Actionscript 3 :: Can A Document Class Extend Another Custom Class That Extends MovieClip?

Aug 16, 2011

If I have a Document class that extends MovieClip, and I want to use it as the basis for another Document class, is it possible to create a subclass that extends the main document class and use that for a different FLA?

For example,

fla1.fla has a document class of MyMainClass:
public class MyMainClass extends MovieClip
fla2.fla has a document class of MySubClass:
public class MySubClass extends MyMainClass

I've tried, but now I'm getting errors that all of my variables that reference stage instances aren't being found.

View 1 Replies

Actionscript 3 :: Call A Server Side Script - Whether In A Document Class Or Sub-class?

Mar 13, 2012

while working with a server side script (php or aspx) which returns some data(from the database) can we call it in a sub-class or do we have to make the calls in the document class itself?

View 2 Replies

Actionscript 3 :: Communicate With Server-side Script - Only In Document Class Or In Sub-class?

Mar 14, 2012

Say i need to send some data from AS 3.0 to a server-side script for it to do some actions. Can I do this in a sub-class called some where in a document class or should we always do it in a document class?

View 1 Replies

ActionScript 3.0 :: Referencing A Textfield Inside A Movieclip Class From Document Class

Feb 3, 2009

Ok, this is one of those walls that I know once I can jump over it, I will be a much happier developer again.

I've done tons of reading, and think I have a firm understanding that the general consensus is that if you want to reference something, it needs to be added to the display list, using addChild().

I hate to be defiant, but what if I don't want to?

Or at the very least, what if I want to add a movieclip class to the stage using addChild, and then reference objects inside it?

It is much easier this way than what most people recommend - adding 15 objects via addChild, then setting the x and y for the, etc.

That said, I'm all about using classes and using as3 the way it was meant to be used. So what this is, is a best practices question I guess.

HERE ARE THE STEPS I'M TRYING:

- Create new flash document

- Draw graphic symbol bg, with text field over it, select them, convert to movieclip symbol, and export class name "box", then delete it from stage

- Add document class .as file, which simply adds that class "box" from the library, to the display list using a simple addChild()

- Set a name for that box using box.name = "test" let's say

- Do a simple trace like the following - "getChildByName('test').textFieldName" - it shows up great

- So then, I'll now try to set the text by doing this - getChildByName('test').textFieldName.text = "yo";

That last line above, is what doesn't work. I know I'm referencing wrong, but how would a pro as3 developer, reference something on the stage within a movieclip class, from the document class?

View 1 Replies

ActionScript 3.0 :: Passing Variable From Document Class To Movie Clip Class?

Oct 12, 2010

i have a movie clip which is exported for ActionScript , i want to get a variable from the document class into the movie clip class i tried this but there was an error !!

ActionScript Code:
var main:Main=new Main();
main.txtScore.text="hello";

View 1 Replies

ActionScript 3.0 :: Pass Data From Custom Class Back To Document Class?

Apr 20, 2011

I have a custom class created by a main document class, and I want the custom class to run a function in document class after some time.

How can I sent the instruction from custom class back to the document class?[code]...

View 6 Replies

ActionScript 3.0 :: Reference Movieclip On Stage From Custom Class Of Document Class

Dec 7, 2009

Is there a way I can reference a Movie clip I have on the main stage from a custom class of a document class?[code]

View 1 Replies

ActionScript 3.0 :: Class Is Loading The File But When Return It To A New Xml Object In The Document Class It Doesnt Load It?

Aug 18, 2009

I found myself loading a new XML file every day and so decided to create a small class that will load the xml file and return it.The class is loading the file but when i try to return it to a new xml object in the document class it doesnt load it.I think that it's something to with the return being in a nested function but i tried a few ways and non seems to work.
 
[DOCUMENT CLASS]
loadXML:LoadXML = new LoadXML();
myXML:XML = new XML(loadXML.loadXMLFile("gallery.xml"));[code].....

View 1 Replies

ActionScript 3.0 :: Passing Data From Document Class To Base Class?

Mar 1, 2011

I created a movieclip with a star. Then, I creates a document class and I named it as Main.as.

In that document class I wrote:
package
{
import flash.display.*;
public class Main extends MovieClip

[Code]....

I´m not posting here all the code, but you can easily see that I´m using x_origin and y_origin variables to keep the original position of the movie clip. I will use them to move the star back to the original position.
 
The problem is that instead of being 20 and 30 respectively, tracing them I see that they are both ZERO. So when I drop the star, instead of going to x=20,y=30 it moves back to x=0 and y=0. I´ve to get the star position relative to stage, but I can´t find anyway!

View 4 Replies

Flash :: Loader Class Problem Tracing The Swf (document Class)

Oct 12, 2010

I am using the Loader class to load 3 external swfs: sharedTopics.swf (does not have a document class) fonts.swf (document class is FontManager) main.swf (document class is Main) The same loader is used to load all 3 assets.

[Code]...

View 2 Replies

Actionscript 3 :: Stage Properties In Custom Class, Not Document Class?

Oct 14, 2011

I need to use stage.width/height in my CustomClass so I found some topics about it.

if (stage)
{
init(ar,firma,kontakt,oferta,naglowek,tekst,dane);

[code]......

View 1 Replies

Actionscript 3 :: Access A Displayobject On Stage In A Class That Is Not A Document Class?

Mar 7, 2012

How to access a display object on the stage in a class which is not a document class?

I am looking for a solution that doesn't involve passing the stage as a parameter to the class.

One solution i always come across is using "TopLevel.as". Is it a good method because as far as I have heard using global variables is not recommended because it might cause some problems while working on big projects.

View 1 Replies







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