ActionScript 2.0 :: Consolidate Two Different Listener Object Types?

Jul 29, 2009

ActionScript Code:
/* Setup listener for each video/audio cue point ============ */
myListenerObject.cuePoint = function(evt:Object):Void  {
if ((evt.info.time == cpTime[n]) || (evt.time == cpTime[n])) {

[Code]....

The code above does not work because of the if/else if statements. What I'm trying to accomplish is that I have a listener object that in one frame listens to an flv playback object, and in another frame listens to an mp3 file.

The listener code for both types are exactly the same, except that the flv listener uses the evt.info.time to check for cue points in the flv and the mp3 uses evt.time to listen for the cue points in the audio. Since I can't combine these with an OR operator, is there any other way to consolidate these two, or do I just need to keep two sets of the same listener code for each to refer to?

View 1 Replies


Similar Posts:


Actionscript 3 :: Use The Same Event-listener Callback For Multiple Event Types?

Nov 18, 2011

This might be more of a subjective question, but is it generally best practice to have one dedicated method per event-types that you add an event-listener?

Such as:

myButton.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
myButton.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
//Somewhere else in the code...

[Code].....

And if you had a MouseEvent.MOUSE_UP, MouseEvent.MOUSE_DOWN and other relevant MouseEvents event-listeners to watch for, you could even set a switch statement to handle all the various MouseEvent types.

View 1 Replies

ActionScript 2.0 :: Access The Parent Of A Listener From A Listener Object?

Feb 11, 2008

I am having a weird problem with scope/reference. I am using a loop to preload a number of thumbs in one go, I am creating a different listener for each one on the fly and then passing event handlers for each one of them. This should not be difficult using a loop, but somehow I cannot access the the parent object on my listener and therefore I can't do much with my thumbs after they are loaded.Here is the relevant segment of my code. myThumb_mc is a temporary variable that does not exist when the loop finishes, you can copy and paste this code to test it though. It should work to that extent. (you'll need an image1.jpg to be in the same directory)

Code:
var myThumb_mc = _root.createEmptyMovieClip("myThumb_mc", _root.getNextHighestDepth());
myThumb_mc.clipLoader = new MovieClipLoader();
myThumb_mc.clipLoader.loadClip("image1.jpg",myThumb_mc);[code].....

The code above works, but it does not look nice and it cannot be the right way of doing this. Long question short, how can I access the parent of a listener from a listener object? ._parent does not work.

View 9 Replies

Flash :: Get Names And Types Of Every Object Of A Swf File?

Jul 20, 2011

If I have a swf file, is it possible to retrieve object names and types (some kind of reflection) somehow?

View 1 Replies

ActionScript 3.0 :: Map Data Types To Custom Types?

Jan 24, 2012

Consider the following function:

Code:
public function foo(bar1:int, bar2:uint, bar3:String, bar4:Boolean):void{}

What I want is to have the different types of data represented by custom named types which are essentially representing the original data types. I other word, I would like to proxy the data types and have a valid function as following:

Code:
public function foo(bar1:PAR_Bar1, bar2:PAR_Bar2, bar3:PAR_Bar3, bar4:PAR_Bar4):void{}

so PAR_Bar1 would proxy the `int` data type, PAR_Bar2 would proxy the `uint` data type, so on and so forth.

The reason I need this is because I'm using a debugger with a GUI that can run methods and allows changing function parameter values in real-time, the issue is that the debugger can't tell me what parameter I'm changing, it only displays the data type of a parameter. So if I need to change 10 different parameters all of type int, the debuggers display all of them as int and not by their names.

I think that if I use proxy types I can easily differentiate between parameters.

So, my question: Is it possible to proxy data types? I mean map specific data types to custom data types that would represent the base data types?

View 2 Replies

Java :: When To Consolidate Code Duplicates?

Sep 2, 2010

We're using a code static analysis tool (Sonar) to detect duplicate code on our project. It appears that there are a great many instances of duplicates in the code but most of them are less than 10 lines and occur only once. In the 'opinion' of the Stackoverflow community,Where should you draw the line at consolidating code duplications? For example should it be at >= 10 lines for individual duplicates or should you consider overall number of lines duplicated eg. consider > 10 duplicates that occur more than once.For context the programming languages I'm looking at are Java and ActionScript.

View 4 Replies

Professional :: Stretch Or Make The Time Line Smaller Or Consolidate It?

Aug 8, 2011

how do I consolidate adobe flash arrange window area so that I can make my time line small to be able to see the whole movie with keyframes how I want to see them.  there are some times I have to scrool alway the way right, how do i avoide from doing this?
  
Something similar to how adobes audition stretches waves is this possible to do in your timeline?

View 6 Replies

Actionscript 3 :: Create Event Listener To Execute A Function When Object A Collides With Object B?

Mar 26, 2011

Alright, I've looked online at a bunch of different collision tutorials but they don't explain what I'm looking for. I want object A to hit object B and then execute a function via to a Event listener.

View 1 Replies

ActionScript 3.0 :: Why Add A Listener To An Event Object

Dec 30, 2009

stage.addEventListener( MouseEvent.MOUSE_DOWN, clicSouris);
function clicSouris( pEvt:MouseEvent ):void {     var positionX:Number=pEvt.stageX;     var positionY:Number=pEvt.stageY;    

[Code]....

what appens when I add an Event Listener to Object Event?

Following the logic with the display list in AS3, I thought only Classes who inherit flash.display.InteractiveObject could react from events coming from mouses (or keyboard).

View 5 Replies

ActionScript 3.0 :: Assign Listener To An Object?

Jan 29, 2012

trying to find how to assign listener to an object created with this function...

Code:
private function placeBtn(thumb:String, Xthumb:Number, Ythumb:Number, targetHolder:MovieClip, ID:String):void{
var clipHolder:MovieClip = new MovieClip();

[Code]....

View 5 Replies

ActionScript 3.0 :: Referring To An Object Outside Of The Function In A Listener?

May 31, 2011

I have four buttons named button1, button2, button3 and button4.  I want the code to trace the name of the button when the button is clicked.  This is just an eample of what I'm doing in my project.  The project itself is too convoluted to put up and explain.  My problem that needs to be solved is, how do I refer to the button in the Function?
 
var c:int;
var buttonName:String;
for (c = 1;c < 5;c++) {
buttonNum = "button"+c;

[Code]....
 
When I say "trace(this)", the code doesn't know what "this" is because I've taken this[buttonNum] out of the loop by having to put it in a Function.  How do I call to the object that is in the listener that called the Function?

View 8 Replies

ActionScript 2.0 :: Can't Access Listener Object From File

Apr 16, 2007

Trying to access a listener that I have created in a .as file from within a .fla file. My chapters.as class is as follows:

Code:

// Define Chapters
class Actions.chapters {
// Constructor function that is called from external swf file

[Code]....

how I can access this properly or do I have to define the listener object within the .FLA file?

View 2 Replies

ActionScript 3.0 :: Run Event Listener Through Dynamic Object Call?

Apr 27, 2009

I have a movie clip being dynamically added to the stage via an AS3 linkage call:

gameOver_mc = new GameOver();
stage.addChild(gameOver_mc);

The movie loads as required.But when the movie has been added I want the user to be able to press spacebar and a function to run.So in the GameOver.as class I wrote the following:

Code:

package
{
import flash.ui.Keyboard;

[code]...

But as soon as the movie clip tries to load I get the error message: TypeError: Error #1009: Cannot access a property or method of a null object reference.I would have thought this would work fine. When I trace the statement in the Constructor function is works. Its only when I try to add an event listener that I get the problems. So am I not allowed to add event listeners from a dynamically loaded class?

View 2 Replies

Jquery :: Flash - Click Listener On <object> In IE Failing

Apr 23, 2010

$("#listView object.modal").click(function(){
// Get the ID of the clicked link:
var link = $(this).closest("h2").attr("title");

[Code]....

This fires a modal (jQuery UI). It it working in FF, Chrome/Safari but not in IE 7/8. Is there something I'm missing here?

Big Picture: We're using a swf to render custom type and there is a link in the rendered (flash) content. We're hoping to catch the link action in the jQuery listener so we don't have to extend our swf have an optional param to return false on link click.

View 1 Replies

ActionScript 3.0 :: Add Click Event Listener Inside Object?

Feb 23, 2009

I'm trying to add an event listener inside an object but it doesn't seem to work. other OO languages it makes sense for an object to be able to attach events etc itself rather than have some external action do it.Here's an example of what I'm trying to do:

ActionScript Code:
package {
import flash.display.MovieClip;
public class Player extends MovieClip {

[CODE]....

This gives an error "1120: Access of undefined property MouseEvent." suggesting that I don't have access to MouseEvent from within the instansiated object.What I can do is create an instance of the class from the Document Class for example and then do the following:

ActionScript Code:
newInstance.addEventListener(MouseEvent.CLICK, newInstance.mouseClick);

View 1 Replies

ActionScript 3.0 :: Run Event Listener Through Dynamic Object Call

Apr 27, 2009

run event listener through dynamic object call

View 1 Replies

ActionScript 3.0 :: Accessing Object From Array Via Event Listener?

Mar 22, 2010

I'm pretty new to AS3, but I have not managed to solve the following problem: basically adding instances of a bitmap on the stage (working), but then adding an event listener and knowing which is which. So for the first part:

[Code]....

View 2 Replies

ActionScript 3.0 :: Mouse Event Listener To A Graphical Line Object?

Apr 21, 2011

I have to develop an application in flex. In that application an user can draw line while dragging the mouse. Then if he clicks on that line it should be selected. How to add mouse click event listener to a line object?

View 3 Replies

ActionScript 3.0 :: Keyboard Listener - If Click On The Stage First Then The Object Will Move?

Jan 28, 2010

I have two scenes in flash - when you go to scene 2 there is a eventListener attached to the stage to move a movieclip. When I test the movie the only way the keyboard listener seems to work is if I click on the stage first, then the object will move. Is there a solution to this. The code I am using is:

[Code]...

View 5 Replies

Actionscript 3 :: Determining What Object Calls A Function Based On An Event Listener?

Feb 19, 2010

is it possible to determining what object calls a function based on an event listener? for example, i have 2 buttons on stage that call the same function when they are clicked. i'd like the function to determine which button was the sender.

[Code]...

View 3 Replies

Actionscript 3 :: Flash Mouse Move Event Listener And Timer Object?

Feb 15, 2011

Ok I have this 100% width/height Flash embedded and when the user moves the mouse I want to display a panel, which disappears after x seconds if there is no more mouse movement.

I think I need an addEventListener, but I am not sure MOUSE_MOVE is the correct one. When the mouse stops moving I need to start x seconds to hide the panel, so I think with a timer?

[Code]...

View 1 Replies

Actionscript 3 :: Isn't It Redundant To Declare The Data Type Of An Event Object In A Listener Function's Parameters?

Oct 3, 2011

When you click on the button something happens. However it seems redundant to me that in the declaration of myListenerFunction, the event object e of class MouseEvent, actually has to have its data type MouseEvent mentioned.

[Code]...

View 1 Replies

ActionScript 3.0 :: Event Listener - Error #2007: Parameter Listener Must Be Non-null?

Feb 4, 2009

this is the error I am having:

TypeError: Error #2007: Parameter listener must be non-null.at flash.events::EventDispatcher/removeEventListener()
at project1_fla::MainTimeline/btnName()

here is my code:

ActionScript Code:
import caurina.transitions.Tweener;
import caurina.transitions.properties.ColorShortcuts;[code]..........

View 1 Replies

AS2 :: IDE - Stage.width Listener - Trace The Results Of Listener When The Browser Is Resized

Apr 13, 2009

Line 1 Frame 1:

[Code]...

I am trying to trace the results of my listener when the browser is resized...no avail. Are you able to see what I am doing wrong?

View 1 Replies

CS3 : Difference Between The Content Types?

Mar 16, 2009

I was looking for the difference between the different content types in Flash CS3/CS4 - Browser/Screen Saver/Application etc - especially it's capabilities and limitations. Of interest are Standalone player and Application.

View 3 Replies

C++ :: Why Some 'Types' Are References While Some Are 'Primitives'

Mar 19, 2012

Types like Movieclip , String, Object act as references when declared and defined, while types like int, Number are primitives. Why such difference has been made. Why not all of them can be primitives ?

View 1 Replies

ActionScript 2.0 :: Creates Various Types Of MC

Oct 16, 2007

I want to create a function that creates various types of MC. Lets say so:

[Code]....

Explanation: Create function that creates MovieClip, make for statment to create more Mc with that function.

View 5 Replies

IDE :: Add Multiple Target Types?

Nov 24, 2009

I've been working on a cute game and I've hit a bit of a wall

It's a shooting gallery game and I want to add multiple target types (so far this has been easy) but I want to game to randomly bring them up as you play. There are four possible target spots and seven possible targets:

baddie1
baddie2
baddie3
baddie4
baddie5
baddie6
goodie1

View 2 Replies

Embedding Newer Types Of FLV Files

Jun 16, 2010

In the past I embedded several (with makers permission) youtube clips into a html web page (with the file stored on my server - mainly because I think it looks nicer). It worked fine. Now these were the old plain .flv low quality ones. But now I am trying to embed the newer higher quality youtube version, again, with the file stored on my server, and the embed code I used previously doesn't work. Now the new higher quality file is still called flv but it has a codec: mp4a

My old coding:
<object type="application/x-shockwave-flash" width="704" height="546"
wmode="transparent" data="mediaplayer.swf?file=xxx.flv&autoStart=false ">
<param name="movie" value="mediaplayer.swf?file=xxx.flv&autoStart=fals e" />
<param name="wmode" value="transparent" />
</object>

View 1 Replies

What Types Of Files Can Flash Handle

Oct 8, 2009

A gentleman doing the sound track for the video I want to do on Flash has asked me what audio files Flash will handle?  I have looked at Adobe and Macromedia and many other Flash websites and, of course, Flash itself, and cannot find any enumeration of what video files Flash handles, much less any mention of what audio files.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved