Actionscript 3 :: Importing Class On Another Frame?
Apr 15, 2012
I am using external AS files for a new project of mine, which involved creating a place to draw so i used the following tutorial to get a basic idea of what is need. I got the hope application working and running smoothly until i decided i wanted to add in a preloading & Menu - putting the drawing part of the app on the third frame - which got me this error:
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
- at Main/convertToBMD()
- at Main()
So I thought instead of adding the Main.as to the Class under properties i would import the file on the frame instead. Using:
var main:Main = new Main();
addChild(main);
This worked apart from it loses all connections to the instance names.
Line 64 1120: Access of undefined property pencil.
Line 65 1120: Access of undefined property eraser.
Line 65 1120: Access of undefined property txt.
Line 82 1120: Access of undefined property board.
Line 83 1120: Access of undefined property board.
Etc.....
So what i would like to know, is there a better way of doing this and getting it working on any frame?By changing something in the external script or another way of importing onto frame?
Is there a way of importing my class using the Actions Panel on frame 1.[code]No errors but the constructor function does not run, how do I get this working? (Everything is fine when I use the Document Class box and typ in the name of my class - but I want to do this on the first frame of the main timeline).
I'm having some problems importing a class, the message that Flash gives me is this; The class being compiled, 'ImageLoader', does not match the class that was imported, '[URL]'. The only line of code in my flash movie is this: import com.martijndevisser.*; And yes, the class is in that folder The class is from here: [URL] I've used the class before and it works fine, I just dont know what to do?
I'm not allowed to import classes into other classes but I am not sure how to achieve what I want. I want 2 custom classes to pass data one from another directly. I have 2 custom classes I want to use: one extends the XMLSocket Class:
class Game extends XMLSocket { import XMLParser //not allowed to do this I know! var parser:XMLParser = new XMLParser();[code]....
As I say I realise I am not allowed to import the parsing class into my Game class (or any class for that matter) but I don't know how to pass data directly between these two classes without referencing them in the main FLA.
I am facing a technical proble when I am importing a "FlashVarsParam.as" class file in my main class " VideoPlayer.as" and when I am using "FlashVarsParam.as" in my FLA doucument class "VideoPlayer.fla" then it is workining fine. "FlashVarsParam.as" file given below so I am accessing in my main class and then it gives me error
I have a scroll file, taken from a tutorial, which is linkedto a class. After having customized my file I did try it and itworks fine. The problem is starting when I try to import this fileto an empty MCL in my website. When I have imported all theelements they do not respond and act like single pieces (es. thescroll bar is detached from the scroller). What can I do?
I am having problem with importaing package/public customClass via a code snipit Scripting. Here are the details I created a customClass.as ActionScrip3.0 script saved it as customClass.as inside an unnamed package then I creeates a blank customClass.fla file (notice the the name customClass.fla and customClass.as must be identical for this to work)and in the properties section simply put customClass.as and then I run customClass.fla test movie and it works fine.. The problem is how do I call customcClass.as again in myFlash.fla that does not have the name customClass.fla file using a code snipet
I downloaded a sample flash that contains a class file.When try to run the file get the "1172: Definition be.nascom.flash.graphics:Rippler could not be found." error. Rippler is the name of the file and I think be.nascom.flash.graphics is the authors directory structure. I think the error is because the file is not in the right location that Flash is expecting it to be in to find it.
A very weird problem is happening in my AS3 code.I made a custom class called test, and in the main document class I imported it using "import test". Also, I set the class path correctly so it should work fine. Now, the problem is, when I instantiate this class to an object, it works fine as long as it is outside the document class constructor, it i try to use it inside the constructor method, it doesnt work!
Just like the subject states, I am indeed having frame rate problems importing video to Flash CS3. When I export a video from Premiere with the settings: 1280x720frame rate of 23.976using H264 or Animation (basically every codec produces the same results),"embed video on SWF and play in timeline" When I do this the file exports fine. Playing it in Quicktime works fine and the audio syncs up no problem. But when I import it into Flash using the same settings, for some reason the movie clip is now too fast in that the video does not match the audio and seems to be at more like 12 fps now (just a guestimate). The action of the video is over long before the audio even comes in.I have verified that the frame rate is correct in Flash so it's not that.
I've done this literally hundreds of times in the past and suddenly it does not work and I can not figure out why. I'm not even really using video, but actually artwork that I am putting together as an animatic for an animated piece so the video could not have been imported incorrectly or digitized wrong either.
I have a problem with importing of outer class. Here is the scenario: This picture shows the directories structure: I have a *.fla file located in "main/" directory and I'm trying to import outer class XModel located in "main/org/XLEFF". Here is the code:
I have a Flash document containing several subclasses. I want to access a custom cursor class I wrote from another subclass called 'mapmenu'. The thing is, it's not working properly. I can import it from my Main class, but not from any subclass. Some bells should be ringing..This is the custom cursor class (located at C:/Flashproject/com/own/Cursor/Cursor.as):
Actionscript Code:
package com.own.Cursor{ import flash.display.*; import flash.events.*; import flash.geom.Point; import flash.ui.Mouse; public class Cursor extends MovieClip private var stageRef:Stage;public function
[code]....
I let all the other script out, it's a bunch and it's not needed for the cursor to function.In the .FLA I have a MovieClip called Cursor containing a cursor. It's exported on frame 1.The problem is: the cursor class won't be called. No errors, no cursor, no trace (see cursor class).
EDIT:FYI: I would put this in the main class:
Actionscript Code: cursor = new Cursor(stage);stage.addChild(cursor);
But I can't address stage from a subclass can I..?
I 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
I have 2 as3 files, which are the classes used . I have to use it with the main flash movie.. How will I include those as3 files without using document class..
I'm trying to create an external file for mouse movement sensing so I don't have to rewrite it everytime I want to use it, which is what .as files are for, I understand.I think the package is working (kind of) but I'm not sure how to get it to run as every tutorial I have come accross applies to graphic use.This is my package (I don't know why the coding is unalligned):
ActionScript Code: package {[code]....
I've tried 2 ways to get it to work: 1.) Assign a class to the stage in the properties panel. When I did this I had no errors but the ENTER_FRAME function did not work, which entirely defeated the purpose of the coding.
2.)
ActionScript Code: var test:mouseVisibility = new mouseVisibility(); addChild(test)[code].....
I have a main.swf with a loader that loads an external.swf file. That file is an xml photogallery. The gallery has two other folders lets call them folder1 (contains xml file, image files) folder2 (which has sub folders that contain.as files for the tweens) I need to import these files to the main.swf or is it export these files from the gallery to the main.swf?
am new to flash and am trying to create simple program, I kinda know how to code the program but its really difficult to interpret everything into action script. For example I created class file in file node.as
I'm new to AS3 and I'm working on a game that I've run into a problem with.I converted a movie on my main timeline to a movie clip and suddenly my event listeners weren't working right. I kinda figured I needed to import the mouse event class to make it work, but it dp.I have 5 AS keyframes that act on a single button (submit_btn) along the mc timeline. This is the code assigned to each keyframe
import flash.events.MouseEvent; swing_btn.addEventListener(MouseEvent.CLICK,press1 ); function press1(evt:MouseEvent):void { MovieClip(root).gotoAndStop(1,"HitsBrianMFSEmerald
The easy version of my question is this. I have a main.swf that calls and loads smaller swfs. There is a text field in the main clip that holds descriptions (descriptionText). What I am trying to do is to be able to change that text with a string (feedback) from the loaded clips. So in other words, pass a string value from the loaded clip to the main clip and set the descriptionText.text = feedback.
I have worked out (unless there is another way I am not aware of) that I need to use an external class to do this. The issue is that the smaller clips have to live in a folder called "images" to function on our LMS and I can't figure out how to import the classes into my large clip and smaller clips because they are in different directories. I can post some code if needed.
I'm trying to get the as3corelib to work as when I run my file at the moment it tells me: 5001: The name of package 'com.adobe.images' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. /Users/markbunyan/Websites/craftmagic.co.uk/JPG_encoder/JPGEncoder.as I thought I had imported the as3corelib fine but can't get this to work. Can I simply import the code from JPGEncoder.as???
I have drawn buttons on my stage. They all set to export for as3. I then made a class for buttons
package{ import flash.display.MovieClip; import flash.events.MouseEvent; import flash.system.fscommand; public class Buttons extends MovieClip{ public function Buttons(){ [Code] .....
And then I put in my document class ; import Buttons; nothing happens and no errors...
I have the following code string stored in an XML file:
MovieClip(parent).gotoAndStop(15);
I've imported this to the global var...
globals.data.navtest
...using...
globals.data.navtest = test.toString();
It works fine - if I trace(globals.data.navtest); it outputs MovieClip(parent).gotoAndStop(15); What I want to do now is actually use globals.data.navtest in my Flash project to execute MovieClip(parent).gotoAndStop(15); How do I do that? Do I have to import it as something other than a string, or do I have to code something that tells flash "execute the code that is in globals.data.navtest" ?I want to keep all of the code in the XML tag, so I can change any of it without opening Flash CS4.
I have a package (XMLThumbLoader) that loads thumbnails and is supposed to import a scroller class(DSIScroller). The thumbloader works fine, but when I try to scroll the thumbsContainer movie clip, I get "Error #1009 Cannot acces a property or method of a null object reference". Notice that I instantiated the DSIScroller class near the end of the main package instead of underneath the import DSIScroller command. By doing this, my thumbnails show up. If I place the instantiation right under the import command, no thumbs show. I believe the issue is with the dynamically created movie clip: thumbsContainer.
Here is the main package (XMLThumbLoader) Code: package { import flash.xml.*; import flash.display.MovieClip; import flash.display.Sprite; import flash.geom.Rectangle; import flash.events.Event; [Code] .....
I have an issue I've tried to import these tween classes. I get the errors below ActionScript Code: Scene 1, Layer 'Layer 2', Frame 1, Line 1 1172: Definition com.greensock could not be found. Scene 1, Layer 'Layer 2', Frame 1, Line 2 1172: Definition com.greensock.easing could not be found. Scene 1, Layer 'Layer 2', Frame 1, Line 1 1172: Definition com.greensock could not be found. Scene 1, Layer 'Layer 2', Frame 1, Line 2 1172: Definition com.greensock.easing could not be found.
I am trying to create a reusable class. documentation says to use as package name the directory structure.
in directory C:JJGFlashSourceRF i have a class in a package called "package C.JJG.FlashSource.RF {" in my test flash file I have "import C.JJG.FlashSource.RF;" I also tried import JJG.FlashSource.RF;
On my Mac OS X it didn't matter, the setStyle Worked Fine,However I've transfered my files over to PC and working with the exact same things all the styles work EXCEPT for the setStyle("themeColor", "color");On this PC it's always turning it from the default "Greens" to a solid gray shade of borders, this is very weird.
For Example
Code: // Have a button component on stage import mx.controls.Button _global.styles.setStyle("themeColor", "haloOrange");
[code]....
It works just fine, do I need to edit the core class files for something? I'm extremely confused, I inport the class files in the first place so I can do public vars and strict data type them to that component.
I am importing a picture in flash and i found out that there is a difference between importing to the stage, and importing to the library... [URL] I've placed both picture close of each other and if you look closely, you'll notice that one of them is losing some resolution. Both picture come from the same file, a png. The picture imported to the stage is sharper than the one imported to the library. is there a way to import that picture to the library without losing any resolution?
I 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