ActionScript 3.0 :: Overload A Native Class?
Nov 25, 2009
I'm not so confident in OOP, and I don't know if "overload" it's the right term.I want to add a method to the MovieClip Class, for example, how can I do that?
Code:
myMovieClip.myFunction("lol");
View 5 Replies
Similar Posts:
Nov 19, 2008
Is my understanding that there are no Abstract classes and you can't override or overload constructors of derived classes correct? Abstract classes aren't important for me but if it's possible I'd like to know how. But is there a way to overload default constructors and I'm just doing something wrong? Can we only override methods or can we overload them also.For a simple game I'm making, I'm not using FlexBuilder and don't want to for this project for specific reasons, so I'm using Flash and instead of using sprites and bitmaps I want to draw shapes in Flash and covert them into MovieClip symbols which I "link" for export as AS to use in my code. I want to make it a little modular so I can just change certain aspects of the code for different approaches.If I create a class Actor which extends MovieClip the default constructor has to be Actor() with no arguments. But I'd like my class to be able to have arguments like initial x and y coordinates. I know you can just create methods to initialize each part but I'd like to try and have a default constructor to do so.
In Flash I notice that if you derive a written class or built in class it requires the standard default constructor, "which I may be wrong about and I hope I am and someone could show me what I'm doing wrong", I found if you derive a class based on a symbol you linked for export as AS I can create a new constructor with whatever argument(s) I want (so this is why I'm making this post,if I can do this couldn't there be a way to override
constructors?).
1) So I create a base class called Actor which extends MovieClip save it as Actor.as and default constructor of Actor() add whatever properties I want.
2) Then I create an object in my library, let's call it mcShip, then I link that symbol for export as ActionScript and have it's base class as Actor and name the class ShipMC.
3) I then create a new .as file and call this one ShipActor.as, this class ShipActor extends ShipMC and then I create a default constructor ShipActor(gs:GameScreen, xA:Number,
yA:Number) and this works fine (also I create a method in Actor class called ActorSuper and call it from ShipActor with passed in arguments, since I don't know of a way to overload the parent class' constructor)
If I were to just have my mcShip with a base class of flash.display.MovieClip and I try to create ShipActor with the constructor above it says missing default constructor. The above 3 steps is the only way I can get it to work for now. Is there a way to overload the constructor? If not are there any other work arounds?
View 1 Replies
May 18, 2010
I am creating a text input control on top of the native TextField class. I am trying to make the input text field itself behave in such a way that hitting Enter when focused and typing, instead of adding a line feed, produces a kind of "submit" event from my control, clearing the "submitted" text input. The described above works quite well. My problem is that I currently rob the users of my control the simple line-feeding ability - instead of a line-feed, a "submit" event is dispatched.
Obviously my control is designed for sending text rapidly, but it is also multiline so I want people to also be able to insert newlines. Think of this as a chat text input control. What I thought about is, somehow capture Shift+Enter and make it behave as Enter usually does. This has proven to be absolutely impossible, and I know a thing or two about Flash Player.
Part of the problem is, Shift+Enter by default does not itself produce a newline (even though pretty much everything else that types in any OS, does) and I cannot patch the event - f.e. by setting 'shiftKey' property to false at capture phase so that the event moves on as if Enter was pressed instead. How to do this, sort of replicating a TextField entirely down to a caret and all?
View 2 Replies
Apr 23, 2007
Is there an easy way to code something, using the tween class, to go back to its native size after being scaled down using the tween class? I checked the tutorial on the site and couldn't find any information on this.
View 5 Replies
Feb 20, 2012
I have some files in my src directory, some are .class files (Java class files) and some are .properties files, when I create the Adobe air native installer these files are not included. Why is that? How can I work around that?
Also it excludes .mxml files, but that's good. I'm sure that's related, how to change what it includes or excludes?
View 1 Replies
Jan 3, 2012
I'm developing a multi monitor fullscreen application with Adobe Air 2.6. I can create a window for every monitor, and put those windows to fullscreen.
theWindow.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
The problem comes when interacting with those windows. If I click the window on the main monitor (the one with the dock and menu bar) no problem, but when I click any other window the system menu bar becomes visible. I've tried resizing the main window to match the monitor size and moving it to a negative coordinate but it always stays behind the bar. Is it possible to do this in Air?
View 1 Replies
Apr 2, 2012
I'm working on a native Objective-C iOS app and I'm wondering if it is possible to embed an animation created in Flash into my app. The animation doesn't have to be interactive, all I need is a couple of animated screens (intro screen, loading screen). Is this posible?
View 2 Replies
Jun 30, 2009
I'm trying to add an event listener to a window that pops up (to the whole window) that will close that window when clicked on. Basically it's your typical about window that would be found in any program by hitting help, then about this program. I am using no chrome on it so I'd like to just be able to click it and have it close.
On a less important note I'd like to center the window on the stage when it pops up. Right now I'm just using the x and w properties to get it close to center on my monitor but obviously that won't work for everyone. Below is the code I've tried. No luck whatsoever. Window pops up but stays up if I click it. Any help as always would be AMAZING!
[Code]...
View 10 Replies
Jul 17, 2011
How do I load an external swf into an external window? I'm using the following code, it works if i add the swf to the original window's stage but not if i add it to the new window's stage.
[Code]...
View 9 Replies
Dec 3, 2011
I'm on to designing my 3rd app. I have two already in the Android and Apple stores. Fairly simple ideas these were. Now, I've come across a bit of a challenge. I want to design an app that contains a database of text files, many also containing pictures. I'd like to have it where you can view these files on, lets say, the iPad, and then print them wirelessly, or send them to yourself in an email, so they can be printed elsewhere.
I have considered just creating an ebook and selling that on the store, but I don't think apple allows you to print from these books. Has to be in PDF, and having an app would be a much better way of distributing and updating it. My idea is creating something quite siimilar to how Apples 'Pages' works, just without any editing capabilities. Select document and print. Sounds simple enough but I can't find any code or tutorials to help me out with this. What I want to know is... can I add a button, that will open up and use the printing options built into iOS? Is this possible to do in Flash with AS3 or would I need to learn how to use Flash Builder and Flex? Could it possibly be done in InDesign?
View 1 Replies
Apr 6, 2012
It's a great thing that it's possible to compile an SWF into iOS native app. I think AIR is now the best option to write e.g. small games or interactive books. Of cause AIR app will be slowler than the same app written on e.g. objective C. The question is how slower AIR app will be. Can simple AIR apps be launched e.g.on iPhone 3G or iPAd 1?
And another question is, can arbitrary flash app be compiled into iOS native app?
View 2 Replies
Feb 22, 2010
I have tried the options given on Adobe Livedocs : adt -package -target native myApp.exe myApp.air, but I keep getting the message "-storetype required". I then try with adt -package -target native -storetype pkcs12 -keystore myCert.pfx myApp.exe myApp.air and get the same message. I have already created the .air file and the .p12 cert file in flexbuilder, and am just pointing to these in the command prompt in the specified places, but the same problem occurs. Any ideas?
View 1 Replies
May 19, 2010
I created native air 2.0 app. (exe file) how to implement auto update for it?
View 1 Replies
Jun 16, 2010
I have made an AIR 2.0 app that uses NativeProcess so it needs to be packaged as a native installer (.exe) rather than a .air file.
I first tried using Package Assistant but I kept getting an error telling me it cannot load keystore file. so I tried using the command line
[Code]...
View 1 Replies
Dec 29, 2010
I want to create a native installer for windows, mac and linux machines, Instead of .air file I want to create .exe , .dmg and .deb files respectively. So that i can enable the application to be installed natively.
View 1 Replies
Aug 30, 2011
I am trying to make an AIR application, that needs to pass an image (.jpg/.png) to a C++ app, that does number crunching.(this needs to be done very often, like every 2-3 seconds.) I've managed to pass the image by saving it to disk via AIR, then opening this file with the C++ program (and passing the filename as an argument to the C++ program), but this method is really slow, because it involves lots of disk I/O.
Is there a method to send an image directly to a native process?
Edit: There is a good Flash-C++ communication example at [URL] using sockets. The big problem with this method is, that some firewall settings can block the communication (i get a windows firewall warning, when i start the app).
View 1 Replies
Oct 24, 2011
I am trying to use the IOS in-app native extension, which is found at [URL], and I have linked the SWC with my flash project... The problem I am having is that all of the usage code talks about integrating with a Flex project rather then an FLA - does anyone know if it is possible to port this extension for use with a flash project?
View 2 Replies
Nov 18, 2011
I'm looking into creating an ANE for the facebook ios SDK, just wanted to find out on here whether anyone has already done this / is close to releasing an ANE already ?
View 1 Replies
Nov 24, 2011
Has anyone found a way to get a Native Extension running for Admob yet? Or for iAd for that matter?
There seem to be a number of issues with the ANE, with compiling and with the manifest. Has anyone found a way to have it all sorted?
View 1 Replies
Mar 22, 2012
The structure of my ANE file looks like this:
<META-INF>
<ANE>
<Windows-x86>[code]....
If ExtensionDll.dll uses the functions in the other Dll, the extension won't load. DllMain is not called. It seems like DllUsedByExtensionDll. dll is not in the Dll search path when the air application uses the extension is running. How should I make the application find the extra Dlls, if I don't want to put them into some common Dll path?
View 1 Replies
Jan 21, 2009
Is there a mechanism by which native code can be called from within ActionScript?
View 4 Replies
Jul 13, 2011
I used the following code to create a new window using ActionScript 3 with AIR 2.6, but I am unsure of how to put anything in the window.
ActionScript Code:
import flash.display.NativeWindow;
import flash.display.NativeWindowInitOptions;
[code].....
View 1 Replies
Sep 10, 2011
I see a lot of tutorials out there for the flex environment but none for Adobe Flash Cs5. Not even when it is using the AIR build.How exactly does one communicate with a native process using flash or air?
View 4 Replies
Feb 3, 2011
Are native browser shortcuts(e.g. CTRL+T opens new tab) enabled/disabled be default? How can I enable/disable them?
View 2 Replies
Feb 9, 2011
I'm working on a big app. I need to enable back native keyboard shortcuts(e.g. CTRL+T opens new tab). e.isDefaultPrevented() called in handler returns false, but still when I press CRTL+T new tab is not opened. Is there some other way to disable keyboard shortcuts except e.preventDefault()?
View 1 Replies
Aug 17, 2011
I am running Flash Professional CS5 (11.0.2.489), updater reports I am up to date. The documentation seems to indicate that FP CS5 should support native custom cursors, but it doesn't (Mouse.registerCursor method is undefined).
Should this be supported in FP CS5? Can I update flash.ui to include support? Is it supported in FPCS5.5?
View 10 Replies
Mar 28, 2012
When I try to publish an Air app out of CS5.5 I've started to get this message:It happens with a blank document. I'm using Air 2.5 & 2.6 on SnowLeopard
View 2 Replies
Sep 24, 2009
In AIR on Mac, when I send login creds to a service and they're incorrect, AIR displays a native popup window to try logging in again without dispatching an error event. Twitter provides a header (suppress_response_codes=true), which returns any error as a status 200 with the error message. I'm using HTTPService to connect to a service without a header like this. Are there any properties or headers I can send to avoid this popup?
View 3 Replies
Nov 6, 2009
Works well when set to x86, but don't work when set to x64.
View 1 Replies
Dec 1, 2009
I'm considering using Flash as the UI of a native Windows app, for several reasons, but before I dive in and start building, I figured I'd poll the community to find out whether anyone's got any good examples of this particular approach out there today, just to prove the concept satisfactorily. So I guess that's pretty much the question: Anyone built one specifically? Or better, anyone know of an app in relatively wide distribution that demonstrates the viability of this approach?
View 4 Replies