ActionScript 2.0 :: CS3 - Extending MovieClip With Packages?
Sep 8, 2009
I'm using AS2, and trying to use AS2's packages for the first time, so I can organize my .as files properly. I'm running into some problems though I've got some classes that extend MovieClip, and I've put the class names in the Linkage>Class fields. When I publish, though, I get the error: The class or interface 'ClassName' could not be loaded. anyone know what I'm doing wrong? I tried importing the classes on the main timeline, and even including the directories of those classes on the classpaths list, but no dice
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 want to add a property to the MovieClip class. I just have a bunch of MovieClips that are placed on the stage by reading an XML file and creating lots of clips according to the information in them. Now, I need to know which MovieClips were created below previous clips, and I figure that the easiest way to do so would be by extending the MovieClip class and add an order property.I have some problems though: I don't know how to set or get this order property within the main clip, I don't know how to place this clip within my movie, and I don't know how to create them dynamically (do I just do something like var myNewObjectOfExtendedClass : myExtendedClassName = new myExtendedClassName?)
This is the code I have on my extended class, called Expando.as:
extending a class from MovieClip? I could just make a movieclip variable in the class to make it simpler. I heard if you extend from Movieclip it makes it feel like its dynamic because you have frames (gotoAndStop, etc). However, it allows me to have direct access to variables (or this.) instead of somemc., and I believe thats faster because 1) smaller name variable lookup, 2) no get function call.
I've been going through the OOP AS 2.0 tutorial here on Kirupa, and I was curious WHY this code is in a class which extends the MovieClip class and is used to affect a linkage item in the library:
Code: // init method for arguments which in other normal // circumstances (non-MovieClip classes) would be // given to the constructor. Not an option with MovieClips
[code].....
Is there something undocumented about why I wouldn't pass those parameters in when instantiating a new instance of the class in question? What is different about extending the MovieClip class?
When you do, you'll see that the movieclip should obviously be at position (0, 0) on the stage. However it appears at (25, 5)! if I leave in the original "this.x = xx;", then it appears at (50, 5). If I also leave in "this.y=yy;" then it appears at (50, 10).
What more can be done if I extend MainClass with MovieClip rather than Sprite. I know that MovieClip extends Sprite and it has Timeline defined under it. But still how it will be usable to me by MovieClip ?
package { import flash.display.Sprite; import flash.text.TextField; import flash.text.TextFormat; import flash.display.MovieClip; import flash.text.TextFieldType; [Code] ..... How to use Timeline if I replace Sprite by MovieClip ?
Is there any way of extending a class which is extending the movieClip class? Or generally a way to add extra methods to an allready existing class without having to add them in the actual class declaration. I was thinking of using Interfaces but how can I implement an Interface to a class which is extending a movieclip?
Code: import interfaceName class className implements interfaceName{ //stuff } But where do I put the code which extends the MovieClip?
I would love if someone could take a look at the code below. When you do, you'll see that the movieclip should obviously be at position (0, 0) on the stage. However it appears at (25, 5)! if I leave in the original "this.x = xx;", then it appears at (50, 5). If I also leave in "this.y=yy;" then it appears at (50, 10).
I'm currently working on a AS3.0 project in Flash. I have a main movie clip in flash on the stage. This mc contains 3 frames. They represent the pages in my application. In each of those frames are a lot of nested MCs. Such as menu buttons, display content for the MC buttons, etc. Everything is controlled by a class extending from MovieClip. When I run the application and press the green button on the second frame in a nested MC of the main Movie Clip on the stage. The event must jump to the 3th frame in that main MovieClip.
Here's the problem If I immediately press the green button, everything works great. But this does not happen when I press a different menu button first.
I have a library symbol, exported for Action-Script and to Frame1. Now in the document Class, i write
public class Test { public function Test():void {
[Code]....
Now the code works fine but when i write my own (sealed/fixed) Box Class that surely Extends MOVIE-CLIP, statement-2 gives error , i know the Box Class is not dynamic but the Movie-Clip is Dynamic. Now what i understand that Movie-Clip Class being dynamic becomes fixed/sealed when it is extended by any Fixed/sealed Class???
When we want to know if a MovieClip animation has ended, we use to listen the enter frame event and check if current frame is the final one (where the movieclip frame has a stop).
But we've thought on a new idea: to extend MovieClip and override stop method. In the override we dispatch an event indicating the animation is ended. So, we hope the clip to find a stop in a frame, call the overriden method and execute both, the super.stop() and the event dispatch.
I am a novice in ActionScript 3.0. I am trying to use the sample code from AS 3.0 tutorial but it return me an error "Packages cannot be nested". How can I fix it? Here's the sample code: fla file format.
I want to set them up with packages but tried before and failed.At the moment, I've made a folder,
C:/flash/mbl
In there, I have all my classes that I want to reuse. what do I do next? I'm using Flash CS3, would also be useful to know how to do the same in Flex Builder 3.
I almost have it, ( I think) but whenever I try to use a package with more than one class in it -- even the standard ones supplied in the ActionScript references, they don't work.And, if I have anything in the flash file other than an empty single frame, it breaks. So this precludes the use of library objects, which, if you CAN use them, saves a lot of coding time..
In the Below action script file there is an error saying cannot import mx.controls.Label, I am compiling this through command line on,linux and the environment variable path is set where flex is installed ,how to resolve this
package { import mx.controls.Label; public class Test
how to get this to work. So I have 2 .as files (ImageMain and FullScreenImage)And in the fla file I have a movieclip on stage called menu and this fla is linked to the ImageMain.as
ImageMain.as (part of the code):
Code: package { import com.gfxcomplex.display.FullScreenImage; public class ImageMain extends Sprite { public static var menuIn:Number=-113;
[code]....
When I run the " red" code I get the next error:1120: Access of undefined property menu. It looks like the imported FullScreenImage.as cannot acces the menu movieclip on the stage.
I have made a script, and now has come the point when I need to use removechild. Whenever I try this I get an error. After looking at the problem, I think I need to learn more about scope and packages. I think if I put everything in the correct scope, I will be able to use the removechild command. I tried to make all my vars public, so that removechild would work, however I got an error that anything public needs to be in a package. I tried to add the package part to my script, but got the error that packages cant be nested. I tried some other things and still no luck, just more errors.
So, if anyone could point me to a tutorial, or recommend a book or something, that will help teach me about scope and packages, Or if you are feeling patient and generous, and you think you could explain this problem to a 5 year old, please explain it to me the way you would to said 5 year old. If you maybe think you can help me out on the script, it can be found here: [URL]