ActionScript 2.0 :: Delegate Versus Instance?
Aug 14, 2007
when i'm coding directly on the timeline, i usually create a var like this:
Code:
var home:MovieClip = this;
so i always have something to reference the main timeline's scope. how could i do this in a class? delegate.create gets a little confusing.
i tried a few things like the following:
Code:
class com.myClass
{
public var className:String = "myClass";
public static var version:String = "0.0.1";
[code]...
of course this is redundant because it'll scope just fine as parseNews();, but i'm just wondering why it's letting me scope it like this here and not in the onLoad declaration?
View 6 Replies
Similar Posts:
Dec 23, 2009
I'm working on a video player and I initially developed the player with everything in the .FLA file with no classes. Then I started modularizing my player into classes and realised that my classes are static methods rather than instance methods which doesn't seem to be needed in my player. My question is - is this a bad design to have all of your classes methods to be static rather than instance methods ? As I dont see the need (yet) so that's why i geared more towards static methods, is this a bad design?
View 1 Replies
Jul 12, 2010
When I use a Mouse Event listener with the trace function trace (e.target.name), why don't I get the instance name I assigned in the property panel? Instead I get something like "instance 12". How can I target Mouse Events using the names I assgn?
View 2 Replies
Feb 16, 2007
What is the advantage of using a Delegate class in as2? I realize that it's old news for as3 guys. But Ive got a medium sized as2 project and Im going through my code and wondering why Im using Delegate.create sometimes. What's wrong with "apply"?I admit that I must have jumped on the Delegate bandwagon without thinking anything more than "dhuu...thats what the pros must be using".Am I right in saying that there is nothing at all wrong with simply saying "function_name.apply( this, args )"? Or am I missing something? Is it a matter of memory management? I've done a lot of research on delegation and read all kinds of blogs and scripts from little tweeks to the official.. to >200 lines. Yikes! At the end of the day I wrote my own little delegate class that worked for me (just a rewrite of Proxy without loops). But now that I go though my code I see that I might as well have just used apply because that's all Im doing with it!
Id like to be a better programmer. What am I missing and why shouldn't I do a find and replace here. Why is it better to wrap up "apply"? Will I be better readied to learn other languages?I just don't understand why I was so convinced that I needed the delegate class when I had "apply" out of the box.
View 5 Replies
Oct 30, 2007
I'm having trouble using the delegate.create method (my first time using it!). Here's part of a class I have...
Code:
public function SiteData(xmlFile:String) {
imagesXML = new XML();
[code]....
View 9 Replies
Jan 29, 2011
I have a ColorPicker Component and I want to (on its CHANGE EVENT) have the LISTENER OBJECT ( known as A) change ANOTHER OBJECT's (known as B) color, based on the ColorPicker's.selectedColor. I do this because i need OBJECT A to keep track of the colors used. Also OBJECT B is dynamic and its instance is based on USER INTERACTION thus B can equal B1 or B2 or C based on mouse click at any given time but must only be 1 at any given time. SO I'm trying to "chain" the events together using listeners/ or delegation but I'm not sure at the logic.how do i reference the objects in the event? should I just try to chain B to listen directly to the event? How can I do this without having to attach listers to the colorpicker every time?
View 8 Replies
Sep 29, 2009
I'm having a hard time understanding to use the Delegate class. I don't seem to understand what it does from what I read online.
Will it work for this situation? I want to rollover a menu that expands onRollover. You can then click on buttons within the rolled over portion. Is delegate for me?
View 0 Replies
Dec 8, 2009
I've got records being populated into our database from paypal's Instant payment notification methods...great. now i turn to our flash cs3 app to populate a component datagrid with the stored database data and to my surprise I'm unable to identify any examples on how this might even be done.
How do you connect to an mssql database from within flash cs3 to retrieve data for displaying within a flash datagrid?
I can write a cfc from coldfusion to return a dataset, but overall i'm not sure if i 'have' to learn Flex, or AIR or what to get the records 'read'.
My ActionScript 3.0 bible is vague at best and resorts to php. (which i dont know)
View 1 Replies
Oct 1, 2010
i have a situation like that, and my goal is to access from onRelease either to the class representation and to the onRelease callee (the caller of the release function,that is the movieclip that catch the onRelease event):[code]
View 1 Replies
Sep 16, 2009
I am using a delegate sub-class to perform helper functions for the main app.I have passed all references to it that it needs and it works well apart from the following problem:I also want it to remove an event listener from the main pp.eg:thisStage.removeEventListener(MouseEvent.MOUSE_UP,preOutsideBoundsDragRelease);The compiler tells me I need a reference to "preOutsideBoundsDragRelease" within the removeEventListener statement.eg: "access of undefined property preOutsideBoundsDragRelease
View 1 Replies
Dec 4, 2009
i instantiate a sprite-class "panel" from my main class. then i call a function "show chooser" inside "panel" which instatiates a sprite class "chooser" with some buttons. now when one of the buttons is pressed i need to call a function inside "panel" which removes the "chooser" sprite/class and which calls a function "onChosen" in the main class.
what is the correct/best way to reference these functions so that they can be called from within the panel and/or chooser classes. i am still too much in the old thinking that a function belongs to a movieclip and can functions with _parent. i need to learn the proper way now.
View 2 Replies
Mar 26, 2012
I have a sendAndLoad going on in a separate class file and following guides online I've used a Delegate to handle the onLoad part, like this [code]...
View 0 Replies
Oct 25, 2005
How can I get around using an instance variable in a static function that must be called by the Delegate method?
View 6 Replies
Oct 15, 2011
I need to separate the visual part of a component from the functional part of a component, so that I'm able to replace the visual one with a new one for another platform.
Declaring an instance variable _delegate with the delegate's interface isn't a problem. But how Do I forward non-implemented method calls of the visual part to those of the delegate.
What's the equivalent of PHP's _call()?
View 2 Replies
Jan 31, 2008
I am wanted to know how can i pass a parameter to the function which I'm calling using Delegate class. I know to pass params having static values such as true / false or a static string "hello".
Code:
var myFunc:Function = btn.onRelease = Delegate.create(tihs, releaseHandler);
myFunc.str = "hello";
function releaseHandler()
[code]....
Here str can be retrieved as 'arguments.caller.str' inside the function.But in case i want to pass the reference of the 'btn' button. Then how can i do this ?
View 3 Replies
Aug 24, 2006
I'm using Delegates in a new project I'm working on to call an event handler in my class with the scope of the class.
I'm having an issue referencing which button is calling this handler. Since all of my buttons are created dynamicly, this is a big problem.
I'm used to using forms and components where I had no problem with this and could reference who was calling the event handler by using - event.target
This doesn't seem to be the case with movieclips though, is there another way to do this?
View 1 Replies
Jan 31, 2008
I've written a class that will load multiple SWFs and then call a passed function when complete. My problem is that when all the movies have downloaded the passed function won't fire.
[AS]
// LoadChecker
// this class is passed am array and calls a function when all of the objects in the array are loaded
//
[code]....
View 1 Replies
Aug 20, 2010
Is it possible to delegate heavy computations to be handled asynchronously (on the user's machine)? When it's done, I could just fire an event, catch the new data, and update. I have played with this for lesser operations, by just setting up a que and only handle a few operations per frame; but is there another method? That feels like a heavy handed workaround, and it won't scale with faster/slower machines. IE: 12 operations per frame works fine on the test machine, but my machine can handle more, but won't do it because it's hard coded.
View 2 Replies
Mar 20, 2009
Does creating a new instance of an Object that uses an identical name to an older instance, delete the previous instance? Or should the original instance be deleted first? The code uses a ridiculous amount of XML vars. Isn't it less memory intensive to parse the XML and save the properties to an Object, and then delete the XML Object, rather than keep the XML Object around and reference it's child nodes directly? Is it better form to break up a huge XML file (>600lines/3200vars) into smaller chunks?
View 1 Replies
Oct 29, 2010
I am encountering a problem in my app only when it is run in flash player 10.1.85.3. Some earlier player versions I have tried are working fine.From what I can tell it seems related to the following:
Quote:
from here: h[url].....
When searching for objects (not strings) in Dictionary objects using the 'in' operator, if the object is not found in the Dictionary object, it will be searched for in the delegate objects. With 10.1, the toString operator will be called on the Object if not found in the Dictionary. This can cause problems with Proxy objects who need to define the callProperty function or it will generate a RTE. ...what it means "it will be searched for in the delegate objects"?
View 1 Replies
Jul 14, 2011
-FPS between FLV and Flash file.If I load an external FLV file (24fps) into Flash file(30fps), then the FLV file will be played by 24fps or 30fps?
View 6 Replies
Feb 5, 2006
I'm working on a Mac. Now I made a site and when I compare colors on pc I get a huge difference:s. My green grey looks like it's black. How do you manage to get the colors wright on both platforms? The calibration of my screen is perfect for print.
View 1 Replies
Feb 4, 2010
A Video-loop at 25fps imported to flash, embedded, plays fine if the project fps also is 25fps.But i also want to add a 3D Carousel menu, but at the projects 25 fps it goes a little bit choppy when rotating quick.So I try to change the projects fps to 50, and voila, the menu looks good but the video plays to fast.The video should alternate between clips randomly, and the clips has to be preloaded, thus its embedded in the swf (...or could this be done with flvs?)5-10 clips.
View 2 Replies
Oct 27, 2011
I'm working on a new portfolio, full flash website for myself and so far I've been working on my Macbook Pro almost entirely. The website is somewhat heavy in graphics/animation however nothing too big, all pages are around 500kb or less. Running the website on my MAC in any browser it looks perfect, the animation runs smooth, everything goes great. However, when I try to run the same website on my PC which is pretty good, the whole website feels a little bit choppy and laggy and I'm not sure why. It feels like it chokes for 1/4th of a second every like 2-3 seconds, lower FPS basically.
View 11 Replies
Jun 22, 2009
I have an application that I support but did not create. I need to test it on FMSS 3.0 but the developer version has both Streaming and Interactive Server enabled. Is there any way to disable the Interactive Server in the Developer Edition so I can confirm the application works on Streaming Server without influence from Interactive Server? The application works on the development server but when I move it to the production Streaming Server, it does not respond the same.
View 10 Replies
Jun 9, 2010
I am planning to start a new project in as3 and I want Dependency Injection in the project. I found that parsley and Robotlegs are two popular frameworks for implementing DI in AS3. Which is the best one among these two?
My main requirements are
lightweight
minimal learning
extensive documentation and active helping community
View 4 Replies
May 5, 2011
In Flex world, is DTO / VO same as Presentation Model?
View 2 Replies
Mar 15, 2009
I'm animating various squares that needs to move "smoothly" on the screen.I've tried with the basic Tween and with TweenLite at 30 and 60 fps and the animation still choppy while at 90 fps looks better.
View 4 Replies
Jun 29, 2009
Sometimes one works while the other doesn't, and vice versa.
View 2 Replies
Jun 15, 2010
I have an AS2 .swf file called �sample.swf� This �sample.swf� contains a proportionally resizable background image. An external .swf file �content.swf� loads on top of it. The size of �content.swf� is 900x600 px and it is positioned to the absolute center (x and y) of the stage at all times.
So basically you open the page in a browser and resize it, the background image resizes as well and keeps its proportions and the content always stays in the absolute center regardless of the size of the browser. Here�s my problem, when I resize my browser to smaller than the content size (900x600), the content gets cut off. So what I want is to activate the scrollbars whenever the browser size goes under 900x600 in either directions (x,y) You tell me if it�s possible. I am open to other solutions as well.
Here�s my html code.
HTML Code:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-7" />
[code]....
View 1 Replies