ActionScript 3.0 :: Changing Base Class Permanently In Flash
Dec 28, 2010
For some reason Adobe doesn't allow us to change the size of the handle in the default slider component. This handle is small and hard to click on quickly. If you try to increase the size of it graphically it just gets resized back down to 13x13 pixels. I've looked into the Slider.as code found in:
Program Files(x86)/Adobe/Adobe Flash CS4/Common/Configuration/Component Source/ActionScript3.0/User Interface/fl/controls/Slider.as
And found that on line 803 there is the code thumb.setSize(13,13). I tried changing that to 60,60 but it doesn't change the size of the handle. I don't know much about classes and I didn't think you had to compile these. I thought that in Flash when you clicked on the Components button that it loaded these classes in at that point but I must be wrong.
ActionScript Code:
override protected function configUI():void {
super.configUI();
thumb = new BaseButton();
thumb.setSize(60, 60);
[Code] .....
View 5 Replies
Similar Posts:
Jan 4, 2010
I am creating a ping pong game. And I want to create the ability to control the direction of the ball based on the impact on the paddle. If the ball is coming down at vy = 4; vx = 4;
and the paddle is moving to the left at vx = -5; I want the ball to slightly change its course depending on how fast the paddle is moving. It would probably reduce the balls vx speed on collision, therefore making the ball move more straight (close to the Y axis) when it is moving back up.
I figure the solution for probably doing this would be to measure how fast the paddle is going. My problem is the paddle is controlled by the mouse and has no certain speed. I am trying to figure out how I can measure the speed of my mouse traveling on the x axis.
I am probably going to create a timer that fires every few seconds to determine where the mouse was and where it is at. figure the difference and that will be the speed
View 3 Replies
Jun 22, 2010
I have this Fla which contains a symbol that is linkaged to a certain class that is in my project. That class inherites a base class named CMovieClip which resides in one of the libraries that is in the class path (and inherites from MovieClip).Of some reason, every change that I do in the base class doesn't seem to influence the resulting linkaged class, much as if this library is cached somewhere that I can't feagure out.I tried to create the same conditions in a separate Fla but it does not repeat the issue.I tried to duplicate the symbol but the issue isn't solved that way.
View 4 Replies
Sep 17, 2010
I have two SWF files which I shall call container and slave. The slave file contains a movieclip that extends from a class I shall call base. base extends MovieClip and is compiled into an SWC. slave includes this SWC as a runtime library, while container includes it as merged (and does reference it so it should be compiled into the container SWF).
The container loads the slave like so:
bgURLRequest = new URLRequest(slaveUrl);
var context:LoaderContext = new LoaderContext(false, new ApplicationDomain( null ), SecurityDomain.currentDomain);
bgLoader.load(bgURLRequest, context);
When this loading happens, I get the error that class base was not found. I suspect this has something to do with the presence of the ApplicationDomain in there. I'm not sure what it does exactly, since I didn't write this loading code myself (but I do know that it's there for a reason so it can't be simply removed).
View 2 Replies
Apr 14, 2011
I have a program where I have multiple classes derived from a base class. I want to take all instances of the different subclasses and put them into an array. Is there a way I can search for anything derived from the base class?For example, right now a get the number of children, then see what they are, so:
for (var i = 0; i < this.getNumChildren(); i++)
{
if (i is "type")
[code].....
View 3 Replies
Aug 12, 2010
I have this base class
package sevengames.miranda.front.res {
import flash.display.MovieClip;
import flash.text.TextField;
[Code].....
I then, in the Flash document, create a movie clip which has this class set as the "Base class" in the properties. However, if I then do this.updateText(); in the movie clip's frame script, it complains
TypeError: Error #1006: updateText is not a function.
at miranda_fla::MenuButton_3/frame1()
Why doesn't it work? I know the class is read and compiled, because I had an error there which was reported.
View 4 Replies
Mar 10, 2011
If I've already specified in the symbol's package which class the symbol's class extends, do I still need to specify the base class in the symbol properties dialog?
View 2 Replies
Mar 24, 2009
when I create a new flash project, I would like to put the source files in /src/ folder.When I try to add the base class to my project, flash can't find it.I've added the folder "src/" to source paths, in flash preferences.
View 2 Replies
Nov 2, 2010
I have a class "BaseMenu", which, needless to say, is a base class to menus that have eventlisteners. When I trigger the function to remove the menu itself, I don't know how to remove these eventlisteners, since their respective functions are in the extended classes, not in "BaseMenu".
Code:
//...
public function BaseMenu() {
this.cacheAsBitmap = true;
alpha = 0;
y = 400;
[Code] .....
View 1 Replies
Aug 26, 2011
So I know you can assign a base class to a library definition within the Movieclips library information field but If I have 30 items in the library and I change the Base class this becomes a pain in the ass, can this be done programmatically when I instantiate the library definition?
var new_shiz:MyItem1 = new MyItem1(); // Needs to have a generic base class of MyItem
View 2 Replies
Jan 21, 2010
im getting an error message that flash cant find the base class. i put the as file and the fla file in the same folder, isnt that the first place in the classpath?
View 1 Replies
Mar 24, 2009
I have a symbol in the Library with a Base Class that extends the MovieClip Class and adds some additional functionality. I want to be able to export this from the Library by right clicking on the symbol and selecting Export SWF. I was hopping this would essentially give me the same results as if the symbol contents was on the main timeline and I had declared the Base Class as the Document Class. When I import this SWF using the Loader Class it seems to loose all of Base Class functionality and think of itself as a MovieClip.
Looking at the below sample code, the alpha property is correctly set but the param1 getter is unaccessible. What the hell is going on?
[Code]...
View 1 Replies
Nov 17, 2010
I have a flash file in folder "/" which loads another flash file in folder "/xyz/". The second flash file will load several resource files on its own. Now flash is looking for the resource files at the base folder "/" and instead of the other loaded flash's folder "/xyz/". The second loaded flash file is provided by a third party and can't be modified. Is there any way to dynamically change the base folder of the "application" at run-time? I've heard about the html swf tag "BASE" so I've tried loading the second flash file with a ".....?BASE=/xyz/" but it doesn't work.
View 0 Replies
Dec 19, 2010
I have a holder movieclip, its base class is foo.[code]I put a trace in the constructor of bar so I can tell if it's being loaded properly, and when I drag out foo onto the scene and run the clip, all the little bars within it fire off correctly. However, when I add it to the scene dynamically, such as like this in the Main class:[code]Suddenly, all the little bar movieclips within foo revert to regular old movieclips and don't fire. What's interesting is if you typecast one them as Bar at some point, and their normal class is set to Bar (within the movieclip itself, rather than base class), it works and the constructors all fire, like this:[code]However, if you want multiple different types of Bar clips, and give each a base class of Bar, this won't work. They all spawn as generic movieclips. It DOES work if you go through and typecast them as either Bar1 or Bar2, but that means in practice you would have to try to typecast every child as every top-level object type every time you added the clip to the stage. You also can't have a bunch of movieclips of the same type since Flash doesn't allow it, so each one needs to be a new class, and have that class typecasted when the parent is placed on stage. Kind of defeats the purpose of OOP.
This seems to be a bug in Flash itself, but is there any way to fix it?You can download an example file here with a couple extra traces to show off what's going on: url... It still has its children, they're added and displayed, but their type changes to MovieClip, ignoring the base class.
View 1 Replies
Feb 9, 2009
determine the base class of a Flash library object at runtime, using Actionscript? The toString method gives me the class of the object, but what I'd really like to determine is the superclass of the object. So, if I have an Actionscript class called "Fruit" and I created many different Fruit types in the Flash library ("Cherry", "Apple", etc.), is there a way in code I can determine that an "Apple" is a child of "Fruit"?
View 2 Replies
Jul 16, 2009
I'm slightly new to Flash CS3 + AS3 combo, so its more of a lack of practice question. My question stems from the problem described here http:[url].... . Note, its not the same problem, its a new one.The Problem ,So I have multiple library assets (which are on teh stage) and I want to assign similar functionality to all of them.
Attempt 1: So I create the n assets, create a custom class in AS3, link them to Flash CS3 and obviously enough it gives me the error that multiple assets can't be linked to the same class.Obvious enough to understand (well not completely, because from a programmers background it doesn't make sense).
Attempt 2: Same as attempt 1, but instead of linking all the assets to the same class I make the base class the same class, and let the derived class be dynamically created by Flash on compile time.So the linking works, but the problem is, in my base class I have a method which does something (say an tween) on a child of the library asset. So if the assets on the stage/library are called asset1, asset2, asset3 (same name for asset name, class name, id name), each of them has a sub-movieclip called ... say 'foo'. now if I manually wrote a class for each asset, I could do 'this.foo' to play with the sub-movieclip. However since this functionality is in the parent class, I'm unable to do it.
P.S. If you're form a programming/OOP background, its basically a abstract class problem. My Base class knows how to doSomething(), but it needs aSomething, which is defined in the Derived classes. However I found out that AS3 classes don't support virtual(C++ )/abstract (Java) in the true sense of the word (unless I missed some obvious documentation).
View 3 Replies
Sep 29, 2011
Let's say Class A has the flash.events.Event imported. Now let's say Class B extends Class A. Why in the hell do i need to import flash.events.Event in Class B? It makes no sens at all to me.
View 3 Replies
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
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
Feb 9, 2010
say that i have a base class called Base, that is Bindable and has a String property like this:
[Bindable]
public class Base
{
public var msg:String;
[Code]......
where msg is some textInput field. I am getting a message from the compiler that....
Data binding will not be able to detect assignments to "msg"
is there a limitation with data binding to a base class?
View 1 Replies
Sep 20, 2009
I am creating a Weapon class for a game and the weapons itself will be the sub classes. The sub classes will hard code some values (such as max ammo and the weapon name).
I trying to access this declared data in the base class constructor, at the moment it's not outputting the values. Is this possible?
I've broken my Weapon class for simplicity:
ActionScript Code:
package
{
import flash.display.MovieClip;
[Code]....
My current workaround is creating a protected method in the base class to trace the information and calling that method in the sub class's constructor, this works fine but this doesn't seem like the most efficient technique?
View 7 Replies
Jul 6, 2011
I have an mc called sunny. In the properties panel I export her for actionscript. I put Sunny in the main class and Drag in the base class. The reason for this is that I want her to be draggable. I can't use Drag in the main class as another object is using that name. The Drag.as has the drag functionality. Why can't I drag her. I already have a solution - I wrote a specific class for her and extended the Drag class. However, if I have 10 mcs I'm not going to write specific classes for all of them. Summing up: Using the base class Drag in properties panel - why isn't she draggable?
View 7 Replies
Jan 22, 2010
I have a base class which is being created via remote_object [RemoteClass alias] from the server.I have other specialized classes that are derived from this baseclass, but serialization with the server always happens with the base class.The base class has meta data that defines what the derived class is, for example
[RemoteClass (alias="com.myco...')]
public Class Base
{
[code]....
View 2 Replies
Mar 30, 2010
I have a main swf which has sound on/off buttons. It has many SWF's which are loaded into different placeholders at different time. All of them have different sounds in them. In addition to that there is a music loop going on in the background.Now, this perticular swf lets call it Father will be placed in some swf later on. What I'm trying to do right now is when the sound off button is pressed turn off all the sounds permanently so the child swf's and their sounds stop too.I have found a way in AS2 :
global = new Sound( ) //no movie clip target path.
and add the following code to your off button.
on(release){
global.setVolume(0); //mutes all sound
}[code]....
which ofcourse does not work for AS3. So how can I stop all sounds permanently in AS3? Secondly what if I have one sound (my background loop) which I want to keep going on.
View 2 Replies
Feb 20, 2009
get the base class of an object ?
View 4 Replies
Feb 22, 2009
How do I pass a variable to the subclass? [code]...
When I run this, I get back. Access of underfined property. How I get the subclass inherit the variables from the base class?
View 1 Replies
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
Apr 1, 2010
I'm writing a series of Search windows for an application. I create the FLA files on the stage, each has 3 simple buttons: next_btn, prev_btn, and close_btn. Those all have event listeners which call findNext(), findPrev() and closeWin() respectively. Each search window looks for different things, some with a text box and some with a combo, etc.
So I have a base class com.search that extends Sprite and adds the eventListeners at startup (actually, on addedToStage). Like this:
function isAddedToStage(evt:Event){
next_btn.addEventListener("click",findNext); prev_btn.addEventListener("click",findPrev); close_btn.addEventListener("click",closeWin);}
[Code]....
If I add the event listeners in the derived class rather than the base, it works fine. But that seems to defeat the purpose of inheritance, plus it infers that I won't be able to derive new classes/swfs from those derived classes.
how does one reference objects created on the stage from a base class of that document's class?
View 4 Replies
Nov 8, 2010
I frequently create a lot of Library Symbols, export for Actionscript, letting Flash auto-generate the Class & extending a custom base-class in order to give them all custom functionality w/out having to create a Class for each, and/or without having to create a FactoryClass for instantiating X number of ClassObjects for each Symbol to be added to.It's really fast for prototyping, and with this workflow I've only hit a few obstacles. Those are:
1 - If the Symbol has children you cannot give the children instance-names, else the compiler gives an error related to automatically declaring stage instances. Two workarounds for this are that you can uncheck automatically declare stage instances, and do it manually in your base-class. or you can avoid using instance-names, and use getChildAt().
2 - If the Symbol is a MovieClip, the timeline doesn't inherit the base-classes imports. I don't have a workaround for this.are these limitations that could be addressed by Adobe's Flash team, or are they limitations that are unavoidable without altering the workflow?
View 8 Replies
Nov 28, 2010
That is i have called one AA class in to stage. AA class is extends from BB class. BB class extends from CC class.CC class extends MovieClip. In CC class i have given CLICK event trace("this is CC class"). i am also given for AA class CLICK event ("this is AA class ").When I Click the AA in out put panel "this is CC class" ,"this is AA class ") i want to stop CC Class mouseEvents.
View 1 Replies