I've been struggling with this for almost a day now and I can't seem to find the problem. I'm making an instantiated FLV playback class in actionscript 2, but it just doesn't play the video
Here's the code, if I uncomment the camera parts and attach _cam instead of _stream it will show the camera feed, it just won't play my movie (and I get no errors whatsoever).
I have question regarding removing instantiated objects. Let's say i have a main class in which i instantiate a custom video player (or whatever) class:
Code: ... var videoPlayer = new VideoPlayer(...); addChild(videoPlayer); ...
And inside VideoPlayer class i have of course dozens of objects (movie clips, sprites representing different parts of VideoPlayer) and dozens of event listeners attached to them. My question is, if i want to remove this VideoPlayer class from my main class is it enough to just do:
I have a initApp.as which instantiates a class which needs to access the "currentState" property and the States array as well. However we cannot get this to work as we cannot see how we can access this information.
Within initApp.as currentState is accessed via "this.currentState". This does not work in the class which is instatiated within initApp.as. The following error is thrown:
I'm wondering if anyone has experience with if there is a big difference in performance in ActionScript 3 between keeping a class with only public static functions, and utilizing those functions often (as in a frame event at 30fps), and in turning the class into a "normal" class of which I instead make an instance and call the functions via the instance instead.
I am making my way with AS3 in little steps and have hit a road block. This is what I have:
I have a document class called "Document Class" I have a custom class called "Game"
I have instantiated an object of "Game" class and I am able to trace a class method which return a simple "HELLO". within my Game class, I have a variable(type Array) called "questions" as instance variable.
I would like to add questions to "questions" array by using "Mutator" method, or count the current elements with the questions array and return the total number of questions. I am unable to add or access elements to the questions array.
I usually use if(object!=null) but it doesn't work well.
How can I verify if the class is instantiated. I want to get rid of the 'cannot access a property of a null object or reference'.
I mean, the 'var object:Object;' is just a reference to an Object class instance. When i initialize it with 'object = new Object()' it runs the code in the constructor, initializing it. How can I check if it has been initialized or not.
Im trying to get the value of the textWidth property in class Main from a text field created in an instantiated class Label. When I trace the value from within the Label class I have access to the values. I'm trying to use a get function to pass the value to the main class.[code]
var pic:Picture = new Picture; // custom dynamic class with a method called onLoadPIc pic.onLoadPIc = onLoadMe; i'm trying to change the method of my custom class on the fly for this instance...
I have this class called Main. And inside this Main class I have a method that I'd like to call from a the main timeline.
So on the main timeline I have instatiate the Main class like this:
var mainClass:Class = flash.utils.getDefinitionByName("Main") as Class; var main:Sprite = new mainClass(this, mc1_mc, mc2_mc); addChild(main);
Then on the frame after that, I try to access a function inside that Class like this:
main.prepareGame();
But I get this error:
Scene 1, Layer 'Layer 2', Frame 3, Line 61061: Call to a possibly undefined method prepareGame through a reference with static type flash.display:Sprite.
I'm very confused. When I instantiate a class, I'm assuming that the object is reset to its default variable values. Not so. Consider this:
Code: class ClassTest extends MovieClip{ var arr:Array = new Array(); function ClassTest(){
[Code].....
...even if the two objects have different instance names! It's as if it is making my arr variable static by default, and not resetting it to a new array in the second instance. How do I get around this? Do I need to somehow have this code instantiate itself with something like "this = new ClassTest();"
h1. I have a Class (let's call it "Button") that is linked to a library item (a movieclip) which I have on the stage
2. Now this Button class, when clicked will produce an alert in the form of another class (let's call it "Alert").
3. There are two critical things in the way I want this to work:
A) I want Alert to be a child of the main stage, not the Button class
B) I want Alert to take care of adding itself to the display list, not have Button add it.
So in a nutshell, I want to call Alert like this:new Alert("Hello, Kirupa Forums!");
The Alert class needs to draw the shape (check), add the text (check), add itself to the display list (how? if I try to access "stage" I get a null reference, though I don't know why), and destroy itself (I'll burn that bridge when I get to it).
What I'd like to do is add an event listener to a class instantiated by my document class that listens for different key presses. So far I can't use stage.addeventListener or I get the null object error so my question is:
a: how do i add an event listener to the stage from another class and b: is it even necessary to add it to the stage , can I listen from that class?
I have a class called shapeC that only creates a rectangle and then addChild(rectangle);. That class is instantiated on the main timeline. Currently, the only way you can see that rectangle is to add the instantiated class to the stage via addChild(shapeC);. My question is, is there a way that the shapeC class can add the rectangle to the root stage without requireing the instantiated class to be added to the stage?
I have an XML file which has info about projects for my portfolio, there are 7 of them at the moment. I'm trying to have a preloader animation show up in place of every portfolio image before it's shown on stage. The problem is that there are 14 of those preloaders being instantiated rather than 7!! How could that be possible? Check out my code:
I have a mc in my library called SimpleButton and in the class path for that mc I have the path to my class: com.company.ui.buttons.SimpleButton.
But when I try to instantiate the symbol using the following code, it does not appear on the stage.
Code: var simpleButton = new SimpleButton(); addChild(simpleButton);
The code works fine when the mc class path is just SimpleButton, the symbol is added to the stage. However when I try to use my own class, the base class disappears from the linkage box in the mc properties dialog and the symbol does not appear on the stage.
It does not matter where I declare the var __w:Who in the constructor, as a class var or in another function entirely. The whole thing still operates normally but it's irritating not being able to set my stage.align=StageAlign.TOP_LEFT; in the constructor.... I am guessing it is something in my Who class because it does not happen if I declare any other vars the constructor in Who pretty basic:
I have a class with constructor and overloaded methods in it. When i try to import that class using blazeds i get an error saying [RPC Fault faultString="Unable to create a new instance of type 'some class'." faultCode="Server.ResourceUnavailable" faultDetail="Types cannot be instantiated without a public, no arguments constructor."] How to import class having overloaded methods using blazeds
I am trying to load video using NetStream. I am able to do this by using the Video Class, but is it possible with the FLV Playback? I would like to add a seek bar so people can scroll the video if they want to.
I know the FLV Playback Component has this built in so I would use it BUT I can't load a stream to the FLV Playback, I can only set it's source. This works fine, but it doesn't allow me to unload it, the sound keeps playing, which is why I ended up using the NetStream instead.
So I have 2 questions. 1) Is it possible to load the NetStream to the FLV Playback component? 2) If not, how do I add the seek functionality to my Video Class?
So I've got a video player that works great. You hit 'play', it calls the public playVideo() function in the FLVPlayer class to begin playback, and then other things happen accordingly (the PlayerControls class updates to show playbar progress, etc). Currently, it's easy: there's only one type of 'playback', and it talks directly with the FLVplayer class (and PlayerControls, etc).
However, we're adding different types of 'playback' now, where a poster image could optionally show for xxx seconds ahead of the video (and still needs to update the playbar to show progress). We're also doing the same for a video bumper, which plays between the poster image and the video as well (and also needs to update the playbar class).
In all these cases, there is a common "playback" that needs to be able to be paused (in some cases automatically, like when you click on a menu button in the menu to open a separate section) or restarted. Rather than do a check to see isVideoPlaying || isPosterPlaying || isBumperPlaying, it seems to make better sense to lump all these things into a common playback manager interface.
I've never extended a component class in AS2, and I'm having problems with it now.
Here's my class file: Actionscript Code: import mx.video.FLVPlayback;import mx.video.*;class AkamaiFLVPlayback extends FLVPlayback{ public function AkamaiFLVPlayback(){ super()}}
Here's how I'm trying to instantiate it from the FLA: Actionscript Code: import AkamaiFLVPlaybackvar g = new AkamaiFLVPlayback()this.attachMovie(g,myVid,1)g.contentPath = "[URL]"
Now this does not work at all. I can see that the super class FLVPlayback is creating variables, but it's not loading to the stage or initializing.
I have an MC instantiated as "menu", and inside "menu" there are MCs instantiated with the names of their pages. I'm trying to define a function for each of these MCs on the main timeline and what I did was as follows (party is the name of one of those MCs that are inside the MC menu):
I use this to create new instances of a movieclip:[code]However, when duplicating the movie clip, another movie clip is also duplicated with a var referencing the first duplicated movie clip:[code]The var myurl in souce_mc is empty!
I had more success rendering the gray box if i make a method in the Canvas class that renders it, but is it possible to do it from the constructor, is that even advisable? I'm somewhat an OOP noob, i don't completely understand where everything should go.
I'm facing problem regarding dynamic texts. My dynamic text is placed on the stage and instantiated. I'm setting the text value in AS by using textname.text = smthing... Initially it was showing the correct result on testing the movie clip.. But after few runs it started showing garbage values... When i traced the value, trace showed the correct result but not displayed properly on the dynamic text..I then deleted and recreated the texts.. After some trials od deleting and reinserting it started working fine.. But soon the problem creeped in.
I've created an AlertBox component by doing the following:1) Create new fla fil2) Create shape and convert to movieclip on stage3) Name new movieclip AlertBox in movieclip properties4) Add custom class path in Properties -> Linkage dialog box and Component Definition dialog box:com.company.ui.AlertBox;4) Checked export in first frame box5) To test this stage: Export as SWC file6) Place SWC in components directory7) Create new test fla file
I have a simple component I created which I instantiate in my main program like so:[code]I receive the error "Cannot access a property or method of a null object reference" on the second line because newMessage was not fully created prior to hitting the second line of code trying to set my "body" textarea's text. I know I can build a "creationComplete" event handler, but isn't there a simpler way to do this?
Essentially this is what I want to accomplish, however it doesn't work like this. Is there any solution: - The problem is I can't dynamically name a new object..
import views.printingView; public function initComponent(o:Array):void{ SomeObject::Array = o;
I am loading a swf, "ImageEdit" into another swf, "Shell". I instantiate ImageEdit with
var ClassReference:Class=imageEditApplicationDomain.getDefinition("ImageEdit") as Class; var instance:MovieClip=new ClassReference(); However, I get an error: