ActionScript 3.0 :: Dose This Encompass All Manner Of Display,net And Event Classes
Dec 27, 2009Dose this encompass all manner of display,net and event classes
import flash.display.*;
import flash.net.*;
import flash.event.*;
Dose this encompass all manner of display,net and event classes
import flash.display.*;
import flash.net.*;
import flash.event.*;
I dont understand how extend workes.. when i extend a class,will it replce that class entery point or will a class that extends another have "two" entery points? And can i pass paramters to the extended class?
View 3 RepliesI have got a new requirement in which i have to display my Column Chart in dashed manner.
View 1 RepliesI have issue with TextFormat; when I set TextFormat for TextFeild .. dose not appear !! look at my class:) at the end line ...
View 6 RepliesI have a strange problem
ActionScript Code:
checkLoad = setInterval (intervalOfLoading, 100);
function intervalOfLoading(){ [code]..........
works OK in Mozilla but dose not work at all in Explorer? How is this possible?
for swf integration in html I am using a swfobject.js
i have created an animation and when saved in notepad as an html file everything looks as it should when previewed in any browser, however when i paste the code into my site via dreamweaver the animation dose not appear.
View 22 RepliesI'm making the game Breakout as an AS3 application using OOP. I am getting very confused though. I know that objects should be only responsible for themselves. But this is where I get stuck, they need to communicate as some level to add and remove screens, and I am getting majorly confused as to what is going too far, when it could maybe achieved in a simpler more OOP way. I've worked out the hierarchy of my classes, in terms of where they are being added (I think). I've added a screenshot of the hierarchy.
Have I got the order right based on OOP principles? Like, Introscreen will listen for play being pressed then call a method of the document class that will remove introscreen and then attach gamescreen. Is that right? Another thing that puzzples me. It seems to me if I made a level and put the paddle and the ball in that, then arranged all the bricks in that level, that I'd be duplicating work (based on the fact I need paddle and ball for level 2 also). So it would be best if I could have gamescreen with paddle and the ball and then add level1/2/3 to display list which would therefore set up the appropriate brick placement. But then, wouldn't that mean that I couldn't do hittests because my level 1/2 or 3 wouldn't be a sibling to the bat and the ball, them residing as a sibling in the level's parent class?
I would like people to be able to change this custom scrollItem class, but as the scroller class has some interaction with this scrollItem class (sets id etc), I have the scrollItem class implement an interface to guarantee the presence of the required methods.This works fine, but only if I keep the type of the scrollingItem class within the scroller class. I would prefer to substitute in the interface type for each scrolling item. However, I cant, as the interface is not a DisplayObject. I can get around this by casting the interface type as a DisplayObject whenever it needs to do DisplayObject type things, but this seems like a hideous hack.
View 5 RepliesI am showing the web service data into flex application using datgrid. I need to show this data scrolling automatically in continuous manner. Anyone knows how to do this stuff?
View 1 RepliesI'm really trying to learn and construct a for loop in a practical, useful manner. I'm familiar with for loops, but I've never used one in a practical application. I understand the syntax.
[Code]...
one after the other in a clockwise manner, so that they form one big enclosing square. In my script, I have a square called cell_mc that I would like duplicate instances of cell_mc to enclose to form a bounding box. I would like the duplicate instances to be drawn one by one in a clockwise direction:
ActionScript Code:
// Get depth
var depth:Number = this.getNextHighestDepth();
[code]....
I want to load the logo on the stage in a fade in manner. What I mean to say that its alpha properties will increases gradually and once reached to 100 it will stop. But in my code it loops continuously . It is very easy for all of you but I have some confusion how to write the Delete on Enter Frame.
View 2 RepliesThere are 10 frames where playhead travels from frame 2 to frame 11. If I want the playhead to travel randomly in fixed manner such as :
frame 2, 4, 6, 9, 10, 3, 5, 7, 8, 11 not using gotoAndPlay, just using script in first frame.
So I've gotten into using my own as Classes, and have an interesting question.
My main swf calls a php script that gets data from a mysql database which is returned as XML. Part of that data that is retrieved is a filepath to a jpg image. It then takes that filepath and other information, and passes it to my external class, the "news story" class.
All fine and good. Then, the "news story" class uses a loader to load that image along with some text, organize it, and voila, you've got your own very pretty "news story". (I'm extending the MovieClip class here, though I suppose it doesnt matter)
Now, my main swf uses this component to load multiple of these "news stories". The problem is, theres that load time for the image. The main swf is loading them all one at a time, because they are putting each one together on their own.
The key here is that it be dynamic. So, since we don't know how much text is in each "news story", we also therefore don't know it's height. What I'm doing is creating each story in the main swf, pushing it into a "news story" array, adding an event listener to each ones' loader, and when the event listener is triggered, I want it to go to the 'add content' function where it sets the news story's Y value based off the position and height of the previous story that was added (stacking them, obviously). This makes sense, because otherwise it'd add them all on top of each other and it'd be a jumbled mess.
The problem is, the event listener is on the loader object INSIDE the component actionscript. So, how do I figure out which news story to set the Y value for? Because the eventlistener is listening to the loader, not the class. I hope this makes sense AT ALL. Here is the code:
Quote:
while (fancy shmantzy conditions)
{
/*creates the news story and passes xml data to it (filepath, etc)*/
storyBlock = new StoryBlock(a bunch of parameters);
subCBArray.push(storyBlock); //array that stores each news story info
[Code]....
I seem to have run in to an issue where a custom event is not being heard between objects. Here is my set up: I have two classes, GameBoard and InstructionsBoard, each is linked in the library, in the properties panel as a class to movieclips on the stage.
I dispatch an event from my GameBaord class: dispatchEvent(new CustomEvent(CustomEvent.ANIMATION_DONE));
and Listen for it in my InstructionsBoard Class:
[Code]...
I am an AS3 coder, but I've been given project that needs to be done in AS2, and am having trouble understanding the events model. Inside my controller movie clip, I have a draggable movie clip that dispatches an event when it reaches a point. I cannot for the life of me figure out how to get my controller to properly listen to the event.
The dragger dispatches the event as follows:
Code:
var eventObject:Object = {target:this, type:'Snapped'};
dispatchEvent(eventObject);
Controller script--the complete handler never executes
[Code]....
I try to load classes ex:flash display.Sprite(); and I get error messages. Not just with this code with any class I try to implement. why this is happening. Am I missing the folder that has all of the classes in them in Flash CS3.
View 3 RepliesI'm just starting to build my first proper OOP piece.I have on stage two manually placed MCs.One is viewer_mc:ViewerClass and one is menu_mc:MenuClass.They each have their own class and there is a document class...
PHP Code:
package
{
import flash.display.*;[code]....
So I can call the public method of either class from the other class.However, I am now trying to understand custom events and dispatching them with parameters.which uses a custom event class.This works fine when the dispatchevent and listener are both in the viewer class, but when the dispatchevent is in the viewer class, and the listener is in the menu class I can't get it to work.I suppose for my purposes I don't really need to use the custom event class, I can just call the respective classes' public functions but I just wanted to try and understand how it works.Here's the pared down version of menu class...
PHP Code:
package classes {
import flash.display.*;
//some other imports[code].........
Two buttons, left and right, move the (full screen) backgrounds. If you click the right arrow, the current background moves left, the new background is added to the right, is also moved left, and the old background is faded out. Think of it as a long stream of backgrounds, being moved back and forth with the previously viewed one being faded out with a tween.
The problem is that the arrows appear too soon, and clicking one breaks the whole thing. Main.as adds the arrows & adds the event listeners which then call the functions. The Main.as functions to move the backgrounds use background.moveLeft(); in the backgrounds class, which is where the fade out tweens happen.
So - how do I turn OFF the buttons (added in Main.as) when the tween (in background.as) has finished? I've tried using something like "getNextRoom.addEventListener(TweenEvent.MOTION_FIN ISH, turnOff);" with turnOff referencing the arrows, but it complains that they don't exist (and in the backgrounds class they don't).
I'm using a electronic device to dispatch events within AS3.
short explanation: -->
Think of these events as a KeyboardEvent.My point is to dispatch an Event (like a Key that is being pressed) so I can listen to this event on EVERY Class I need to.I'm not sure how to instantiate or listen to these events correctly =/
I mean: I want to be able to listen to the key that is been pressed as if that was a global event every Class can receive...
long explanation: --> I'm doing something like this:
1) created a (main) Class that extends a Sprite.
2) created a class (KeyboardInput) that extends the main class.
3) created a class (KeyMap) that extends EventDispatcher.
4) created a class (HomeScreen) that extends a Sprite.
My FLA file is associated to the KeyboardInput Class.This Class creates a listener for the KEY_DOWN KeyboardEvent and instantiate the KeyMap Class that dispatches a CustomEvent:
stage.addEventListener(KeyboardEvent.KEY_DOWN,function(evt:KeyboardEve nt):void { keymap = new KeyMap(); keymap.setKey(String.fromCharCode(e.charCode)) });[code].....
What is the proper OOP method of communicating between classes that are not on the display list?
For example: The Document class instantiates a new class just for loading in different XML files. This XmlLoading class should let the document class know when the xml has been loaded and parsed so that the interface can be built out.
From my understanding, events can only be listened to and dispatched through the display list, but since there is nothing visual with this xml loader, it doesn't make sense to me to make this class extend a sprite and add it as a child of the document class.
I am learning how to do a custom event in AS3. I can do an event in a class but I dont know how to detect events in other classes. I want to detect in main.as an event reached in class player. E.g., a variable reached a value 4 in class payer and dispatches an event so main.as can detect it. This doesn't give an error but my code doesnt output I can deect an event in main from classplayer.
//main
myplayer=new ClassPlayer();
myplayer.addEventListener("image_loaded",imageLoad edHandler,false,0,true);
myplayer.addEventListener ("watcher_loaded",watcher_loadedHandler,false,0,tr ue);
addChild( myplayer);
[Code] .....
how can I create event handler for a class that I wrote myself?
Example:
Code:
class blah {
var ladida:string;
function blah () {
[Code]....
How is it possible to create an event handler, like lame.onChange? When the variable inside the class is changed, how would i be notified?
I finally got the variable referencing between classes and custom event problems sorted out. Now I got a question regarding the Error #2044 and Error #2035. The error reads like this:
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
I've put all the swf in the same directory, so I don't think that is the problem. Could it be that my XML file is in another directory that's causing the problem? I also heard having quotes in the URL in the XML file could also be problematic. Is that true? Here are my AS and my XML file.
[code]......
I have 2 custom components, which have their own nesting hierarchy ... One is container for another. I have to "familiarize them" with each other. The way I'm trying to achieve that is using global events (one side is firing and the other one is catching):
Application.application.addEventListener("Hello", function (data:Event):void{
// .. some actions
});
[Code]...
Then should be created the connection between container and it's child.
BUT, the only thing I could acheive is passing a reference to the Container in the DynamicEvent. Is there any chance that I could access the child at the event-handler function.
I'm still struggling with the complete concept of custom event handling within AS3. I know I am close to a complete understanding it's just not falling into place yet.[code]...
View 6 RepliesI'm not sure why my event targets are missing when I add an event listeners to my button classes. So when I try to check which button has been clicked I can't tell a difference between them. Does anyone know what could be causing this? Everything else looks like it's coming through okay.[code]...
View 1 RepliesI found this code for a contact form at msinghinteractive easy-to-use-flash-as3-contact-us-form-class and it dynamically creates input fields and buttons. I didnt like the dynamically drawn submit and reset buttons, so I added my own MCs(my 'buttons') to the stage. I tried modifying the code and took out the dynamically drawn buttons..However, I cant figure out how to add Event Listeners to the buttons which exist on the stage--Im getting undefined errors...The fla is directly associated to a main.as class which just determines the parameters of the .as class it is tied to -to set the size of the Contact form.This is the entire class:
Code:
package{
import classes.*;
import flash.display.*;
[code]....
where btn is the instance name of my submit button MC.My problem is that because my buttons exist on the stage I dont know how to add Event listeners within that class---or rather doing that doesnt work because the listeners are throwing that undefined property errors--I gave them instance names...
You have some examples of how works custom events in as2? If I have 2 classes that extends movie clip, how can I make them to comunicate with custom event.?
View 1 RepliesHow do I call this function for multiple listeners without IDE timeline and frame names, using external classes? Im moving my timeline code to classes, and Im stuck with this..
View 4 Replies