ActionScript 3.0 :: Converting Class To Timeline?
Feb 9, 2011i have a class which id like to run from my timeline. How can i modify the class?
if i rename
ActionScript Code:
public function
[code]...
i have a class which id like to run from my timeline. How can i modify the class?
if i rename
ActionScript Code:
public function
[code]...
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...
I am trying to create a small game that plays videos when you click a button. The following code works effectively;however, it is placed on an action frame and I would like to convert it into a class so that later on additional functionality may be added.I am more of an animator then a programmer but am trying to learn so that I can make games.[code]
View 9 RepliesI would like to store the value from combobox or text area-MovieClip in MyClass and then I'd like to read this from another frame in *.fla file only this :) have you another code? what can I write in frame 2 Miclass and frame 3
View 1 RepliesI have an ArrayCollection and each element is an instance of the TreeNode class (a custom class made by me) that has a "children" property which is an ArrayCollection of more TreeNode elements. That way, I have a tree of elements in an ArrayCollection structure:
tree = new ArrayCollection([
[new TreeNode(param1, param2, new ArrayCollection([
[new TreeNode(param1, param2, null)],
[Code]....
But my problem is: I need to have the same "tree" structure (it doens't need to be the same variable) filled with instances of another class. How can I achieve that?
I've been wondering if it is possible to convert an object acquiredby a getChildByName() function to another class?Let's say i have a library item designated as MovieClip and it is a part of some "sprite sheet". Now, when i need some sprites for my program i create a new sprite sheet instance and then i take sprites from it using the getChildByName():
Code:
sourceSheet = new UISpriteSheet();
someObject = sourceSheet.getChildByName("someObject");
[code]......
I have an array, which are the literal names of class references. Eg. in my main class I have
var page1:PageOne = new PageOne();
var page2:PageTwo = new PageTwo();
var page3:PageThree = new PageThree();
[code].....
Well I finaly found a script that's pretty easy but interesting to use.Then I thought, why not help the community out and try to convert it into a class which would be very dynamic and easy editable.Well I figured out how to draw a dynamic mask, but after that I can't seem to figure out how to implement the mouseOver/imgPanning into the same piece of code.[code]The commented section is the code that makes the img pan, but I cant seem to figure out how to implement this so people can still use the drawRectangle function.
View 2 RepliesIs there a way to link to a class file from the timeline rather than using the Document Class? (I tried using the document class but it messed up because of the nested movie clips and stuff like that... so I need another way)
View 3 RepliesI can't find a way to directly access a MC (or textfield, etc) on the timeline from a Class loaded into my Document Class. No problem from the Doc Class, but can't do it directly from the loaded Class. Is there a trick to essentiall extend the Doc Class AS from another external class?
View 7 RepliesIf I load a class on my root timeline and I have a movie clip call "ball_mc" on the root timeline. How do I make a function in the class control that movieclip? I don't like the addchild because I design my pages and then animate them. If I'm inside the movie clip using actions trying to reference a main timeline item I use MovieClip(root).instanceName.This works perfect, however it doesn't work in a class.
I would use classes if they were easy to reference objects on the main timeline...
I'm trying to write a class that somehow emulates the old AS2 gotoAndPlay(); function, but i'm failing to find a way to reference the timeline that is calling the Class Constructor.
this is what i am using to call the class, i'm placing this code in the frame of the timeline i want to control. but it always gives me a null error.
I Know senocular adressed the timeline issues in one of this forum's post, but i can't figure out what to do in order to register this class in the specific timeline in order to control it.
the frame goes like this:
[Code]....
how to reference a variable that is on my main timeline into a class.Or I need to know how to pick up a variable from my php file (as in "myswf.swf?variable=3") into my class.This was all very easy to do in AS2.I just can't find out how to do it in AS3.
View 4 RepliesI have a class that controls an enemy. From within that class, it checks for collisions with an array on the main timeline. I've done it this way before and it works fine, so I have no idea what I've done wrong this time. It keeps giving me an
[Code]...
I can import other classes to the timeline and use them just fine, but this class is giving me major problems? I am parsing XML data from my server on it and it is giving me errors that look like this.
The timeline reference and usage:
import networkScores;
var network:networkScores = new networkScores();
addChild(network);
score1Textfield.text = network.score1.toString();
[Code] .....
The errors I am getting:
Scene 1, Layer 'Actions', Frame 4, Line 149 1119: Access of possibly undefined property score1 through a reference with static type networkScores.
1067: Implicit coercion of a value of type networkScores to an unrelated type flash.display:DisplayObject.
This is probably something basic, but I was wondering how you can access the document class and its children through a frame on movie clip's timeline.
I tried root.<object I am looking for> and stage.<object I am looking for> but neither seem to work.
I have the following class
Code:
package {
import flash.display.Stage;
[code]....
Which is not a document class. I wish to pass the stage of the main timeline into the class, say on frame 1
Code:
stop();
var c:CustomObject = new CustomObject(this.stage);
Is this the right way of passing the stage of the main timeline into another class?
I have a MC1 with a class that controls it on my timeline. Within this MC there is a second MC2 which contains a short animation. During that animation i need a trigger that will call a method from the class attached to the main MC. MC1 is linked to CLASSMC1 contains MC2(short animation)MC2 calls a function in CLASS
Code:
package {
public class CLASS {
[code].....
I have a multidimensional array on the main timeline. Its name is myInst. I need to access this array from this class to build a scrolling list of swfs which the path to the swfs is in the myInst array. I have not included the entire code/class because the issue is somewhere in this part. The error is 1009, cannot access a property or method of a null object reference. This fla is not going to be the root fla, it is going to be external, so the use of root probably will not work, but I tried it anyway, to no avail.. for any help.
package {
import flash.display.MovieClip;
import flash.net.*;
import flash.events.Event;
[code]....
I need to assign dynamically a path to a xml file through Flashvars. How I can make it work?
I was able to get Flashvar from html page into swf with actionscript code on timeline[code]...
As above is there a way to access any function written inside main timeline from a class?
View 1 RepliesI need to assign dynamically a path to a xml file through Flashvars. How I can make it work? I was able to get Flashvar from html page into swf with actionscript code on timeline:
1. HTML � assigning Flashvars with swfObject:
Code:
<script type="text/javascript">
var flashvars = {};
flashvars.xmlfile = "xml/data.xml";
[code]....
When I set the following class as my document class it works (draws a rectangle) but when I don't set it as my document class and instead instantiate it using var myRec:simple_shape = new simple_shape(); in first frame of my timeline nothing happens no rectangle and no error either). why and how I can get it to work without setting it as my document class?
[Code]...
I've been working on flash CS3 for some time now and have learnt a lot in actionscript 3. However, I still have some very simple doubts which I want to clear:
1) Is the Document Class same as the Main Timeline?
2) If we type "trace(this)" in the actions panel on the main Timeline, it gives "object MainTimeline", is this what is the document class because there is nothing else as the mainTimeline Class.
3) If we type "stop()" in the main timeline, it stops the movie. Where does stop() belong, I mean, it is the method of which class?
4) Sometimes, when within a class or a movie clip, something like "root.gotoAndPlay" doesn't work while "MovieClip(root).gotoAndPlay()" works. Another example is when we try accessing a child of a movieClip by using getChildAt(i), "MC1.getchildAt(i).play()" does not work and we have to write "MovieClip(MC1.getchildAt(i)).play();
I am trying to make a basic timeline for a class but I can't figure out the coding to use. I have worked on an older version- macromedia flash but I can't get cs4 to work for me.What I am trying to do is have a button that is the date. When someone clicks on it or rolls over it information about that date is highlighted. I want the box with the text to turn from grey to white then back.I can make the button and get that to work but I can't seem to get in further on it. Meaning that once I try to connect it to the box with the text everything starts to go crazy.
View 2 RepliesIs it possible to control items lying on different frames of an FLA file from its document class?
View 8 RepliesI'm trying to go to the next frame in the main timeline from a class with no luck.
I have a movieclip called winner_mc that is created in the document class.
winner_mc is linked to the Winner class.
The Winner class creates a movieclip called nextlevel_mc which is linked to the Nextlevel class.
Then when I click on the nextlevel_mc movieclip I want to go to the next frame on the main timeline.
I tried this for the Nextlevel class:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Nextlevel extends MovieClip {
[Code]....
i am trying to create a menu using as3 and i cant seem to find a way to finish it.this is what i got so far
so i wrote a class that is attached to a movieclip and i put several instances of it on the stage.
package {
import flash.events.Event;
import flash.events.MouseEvent;
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;
import flash.display.*;
[Code]...
I wanted the animation to not roll back once i click on a certain button and i wanted the animation to go back once i click on a different button. My question is, how do i proceed from here, i searched online for clues and from what i understood i could set variables within the class and change them on the timeline and use event listeners to catch the changes. I tried doing that but i always end up with some redundant way that gets me nowhere...
I have an array in a timeline that I need to pass to a class file, but I can't seem to figure out how to do this, as the method of inter-class array transfers doesn't seem to work.
View 1 RepliesI have a air for android project going and I am wanting to import a actionscript class for use in the main timeline. I wrote the class and imported it, but I get the following errors: Line 1 5001: The name of package 'com' does not reflect the location of this file. change the package definition's name inside this file, or move the file. Here is from the timeline
[Code]....