I am trying to make a file upload program using as3 and amfphp. Instead of using the upload method I am instead calling an amfphp function and passing the filereference.data as one of the paramaters. This works well and good, however, i have no way to track the progress of the file upload, other then when it completely finishes uploading. I've decided to chunk up the bytearray in flash before i pass it so that i can get more progress information during the upload. The problem is when I try to take the data from filereference and put it into a bytearray it gives me an End of file was encountered error.
I'm using the following code to import class functions the import is fine but my question is what are the diffrent ways to use it once imported right now the cam:CameraExample line throws the error TypeError: Error #1009: Cannot access a property or method of a null object reference.[code]...
I've built controllers for the application which are defined in the Document class while the get & set methods are in the appropriate class. I find they become very screen real-estate intensive once you have more than 10 methods so i was wondering if anyone could let me know a way for writing them which has one function and sets and gets all the properties. heres some of them which define all the height,width, color,stroke,fill,tint of a drawn rectangle.
I'm extremely new to Flash and AS3. I used code snippets in CS5.5 to load an external swf from a main swf. Later I will have 10 swfs to load each with its own button in the main swf. It loads beautifully on top of the main swf. In the external swf I made a button to close and return to the main swf, so the user can then select another button. However I've tried various methods to unload and I have run into two problems. First, the close button does not work, and second if I add code to the close button it screws up the external swfs code. The stop at the first frame does not work and it plays through without the swfs other buttons working. Here is the code to load from the main swf:
I would like to know if it is possible to consume a AMF Service using .NET. I would like to consume a AMF service written in PHP using my ASP.NET Application, that is possible?
The question is how could I stop a method being called twice, where the first call has not "completed" because its handler is waiting for a url to load for example?
I have written a flash client which interfaces with a java server using a binary encrypted protocol (I would love to not have had to re-invent the whole client/server object communcation stack, but I had to encrypt the data in such a way that simple tools like tamper data and charles proxy could not pick them up if using SSL).The API presents itself to flas as an actionscript swf file, and the API itself is a singleton. the api exposes some simple methods, including:
login() getBalance() startGame() endGame()
Each method will call my HttpCommunicator class.HttpCommunicator.as (with error handling and stuff removed):
public class HttpCommunicator { private var _externalHalder:function; public function communicate(data:String, externalHandler:APIHandler):void { // do encryption
[code]...
Will the second call trounce the first calls communicator variable? i.e. will it behave as if its static, as there is onlyone copy of the API object?If say there was a button on the GUI which had "update balance", and the user kept clicking on it, at the same time as say a URLLoader complete event hander being called which also cals the apis getBalance() function (i.e. flash being multithreaded).
In Flash CS4, I've got a project that's working with a lot of XML. Previously, it's all been working fine, but recently I'm getting warnings like this when trying to compile:
Warning: 3594: toXMLString is not a recognized method of the dynamic class XML.
Warning: 3594: appendChild is not a recognized method of the dynamic class XML.
The lines of code that these errors refer to are:
stream.writeUTFBytes(currentXML.toXMLString());
and
currentXML.appendChild(marker.getXML());
"stream" is a FileStream object and "currentXML" is an XML object. "marker" is an instance of my own class, which I have imported, but I'm pretty sure that's not related.As I've said it's only happening now. I don't see anything in my code that could have changed it. Even if I turn the changes into comments, I still get errors.In addition to these two I am also getting other warnings, although all of them concern a method "not being recognized" in the XML class.I am using Flash Pro CS4 and am coding on the first frame of the timeline, as opposed to in a Document Class. Oh, and I'm making an AIR app, not a Flash Player one.
I'm new to AS3. I've got two classes. damnMoles.as and startBtn.as
The damnMoles class uses a method called randomPlay(); ActionScript Code: public function randomPlay():void { this.gotoAndPlay("moleLabel"+randomNumber(1, 18)); }
Which basically allows the looped mole animation to start from various points in its timeline. I could probably use a different method to do this using an interval variable, but I originally coded this in AS2.0 and I want to update it, to see how this are different. damnMoles class is attached to 6 mrMole# instances on the timeline.
Originally I used code on the main stage timeline to start the animation of the moles. ActionScript Code: startBtn.addEventListener(MouseEvent.CLICK, startClick); function startClick(event:MouseEvent):void { mrMole1.randomPlay(); }
This works fine, however, I would like to refrain from timeline code and use .as files. My startBtn class looks like this, but I get the error: 1120: Access of undefined property mrMole1.
there is an SWF file where we used its methods using JavaScript as an reference in HTML.now we want to make an FLASH app & have an SWF as an component where use all that methods in.since Im new here, I need ur comments how can I do it step-by-step.i know JavaScript but new in ActionScript.I use SWF in my JavaScript asCode:
Code: <script type="text/javascript"> var so = new SWFObject("movie.swf", "mymovie", "200", "100", "8", "#336699");
I've written a pre-loader for my game, it uses Loader, URIRequest and LoaderInfo to display a bytes left/total counter as the main game SWF loads - this all works fine.
However what then happens is that the main SWF constructor is called, so the game starts running "in the background" while the pre-loader finishes off.
I moved the 'start game' code from the constructor into a different function but I'm now left with the issue of how can I actually tell the main game SWF to start?
You can't do loader.content.go() (where go() is the function I want to call).
How can I access methods of a loaded SWF? Or is there another way? I tried dispatching a custom Event from the pre-loader, but the game SWF just never heard it - but is this the right way to go about things?
I really want to pass some bits of data from the pre-loader into the main game SWF too, but until I can figure out how to make them both talk I'm totally stuck! Is there a way the game SWF could reference any variables set by the preloader?
I have an object in the library that is linked with class Myclass, I define MyClass in its own AS file and everything runs ok, but as soon as I remove the linkage of the object with the class the compiler generates an error with a seemingly totally different class, that class is part of an open source data structure library for AS3, unrelated to that library object or class MyClass.
The error code is 1044: Interface method ****** in namespace ******* not implemented by class ********.And of course I checked and the class implements the interface methods, all of them so there should be no errors.The library I'm using is a [URL] and the class reporting errors is HashMap and HashTable.
I want to create a game using pure AS in FlashDevelop.
The problem is that there are some methods I want to use, and because I don't like copying/pasting code, i decided to define in classes. Here is an example:
[Code].....
When I hit compile, I get an error like Call to a possibly undefined method distance through a refference with static type Class.
Is there a way in AS 3 to list all classes and their associated methods? Or at least a way to list the methods within a particular class? It seems that it's all so overwhelming and although I'm well versed in Lingo and have a handle on the Lingo dictionary,I feel as though the AS 3 library is dauntingly big.
What are some methods of accessing/loading external SWF's aswell as there variables inside them. I've been using URLrequest and loader methods no luck yet.
I've read in the flex developer guide that you sometimes need to override one of the lifecycle methods like: commitProperties and updateDisplayList but I've written a few flex apps without ever needing to implement them.when do I need to override them?
I'm recording and playing back mic input using Flash Media Server, and even though it's just audio, we're saving the output as FLV. I'd like to get a waveform of the recorded audio. Ideally, since we already have a lot of saved/recorded audio, I'd like something that can take a loaded FLV and get the waveform, as opposed to generating it at record or playback time.
AS3 has the new Sound.extract() method that can be used for this (plenty of online tutorials), but it seems like it only works for MP3. Is there a way to use this method on FLV audio? Or is there another to extract a waveform from a FLV?
How do I get the list of all methods from an object? I know I can get the object class in this way:
var className:String = flash.utils.getQualifiedClassName( myObject ); var objClass:Class = flash.utils.getDefinitionByName( className ) as Class;
In JavaScript I can iterate over the prototype of an object to get its properties and methods. Is that possible in ActionScript 3? Do you any good source for metaprogramming/reflection over ActionScript 3?
I have a class with several methods I must run in an specific order. So, I created a kind of chain where each one calls the next in its last sentence (sometimes with calls, sometimes dispatching events):
internal function a(evt:SwapEvent):void { //started from custom event ... b(); }
[Code]....
But, as far as I know, Flash Player doesn't make a synchronous execution. i.e., it doesn't wait until method a() completes to execute b()
clean and bullet-proof implementation? This application will run in an endless loop 24x7
I'm having a hard time calling a method from a particular class within a MVC design pattern. I'm successful at calling the methods from the base (Model) class but haven't been able to call methods from it's subclass (PhotoModel).
My Objective From within the Controller subclass (PhotoController) call a method from my the Model subclass (PhotoModel).
In my document class file I have the following code which connects the two classes together.
PhotoDocument.as
ActionScript Code: public class PhotoDocument extends MovieClip { public var photoModel:PhotoModel;
[Code]....
I thought that defining the model class in this way would declare the PhotoModel class as the model for the PhotoController class, therefore letting me call it's methods and any inherited methods with syntax similar to this; model.method();. Using this syntax I can call the methods in the base Model class but not in the subclass where I've defined additional methods the base Model class does not have.
I've tried a billion different ways to call the methods inside the extended model class but have only a huge pile of failure to show from it.
I am searching for a way to use one eventlistener with multiple buttons that bassically behave the same way.It works with event.target.(any movieclip property here, e.g. alpha).
I need to call a method writeln() from the method buttonClick() which is in another class. Also need from a method of readResponse () method call loadSocket (str: String) Errors: Attempted access of inaccessible method writeln through a reference with static type main2.as$36:CustomSocket. Call to a possibly undefined method loadSocket through a reference with static type Class.
Here is my code with 2 classes: ActionScript Code: package { import flash.display.Sprite; import fl.controls.Button; import flash.events.MouseEvent; import flash.text.TextField; import flash.text.TextFieldType; [Code] .....
What if you have methods you want to use in your project, that really have no need of a class, or in other words, there is no need for an "object" associated with it. It's not going to have member variables, so why bother making it a class?
for example,
I want to create a randomNumber method, takes two numbers, low high, returns a random between or equal.
Originally in my code I had a very top level class i just called globalLibrary that extended movie clip, i put my randonNumber method there. Then every class in the project extended that. I got the method scoped properly, but to me it looks like a hack.
For example, the most basic functionality in flash like +, even = , trace, etc. Are these also methods defined in some class that we are extending? Or are they methods that have no object associated since that would seem to make just as much sense.
why can't I just create a file of methods, and import that file and have access to these methods?