Question About Btn RollOver Override
Hi,I have a scroller that uses the following code:targY=0;dragger._x=249dragger.onPress=function(){startDrag(this,false,this._x,0,this._x,theMask._he ight-this._height);}dragger.onRelease=dragger.onReleaseOutside=functio n(){stopDrag();}theText.setMask(theMask);theText.onEnterFrame=function(){scrollAmount=(this._height-(theMask._height/1.1))/(theMask._height-dragger._height);targY=-dragger._y*scrollAmount;this._y-=(this._y-targY)/5;}So 'dragger' is a movie, right. And inside this movie, I wanted a button, so that I could have a rollover effect. But it seems the code overrides the button's natural rollover ability, because it doesn't work.dragger.onPress=function(){startDrag(this,false,this._x,0,this._x,theMask._he ight-this._height);}dragger.onRelease=dragger.onReleaseOutside=functio n(){stopDrag();I'm wondering if there's a way to modify this code so that I can use a button inside the 'dragger' movie and have a rollover effect?Thanks very much [sample .fla attached]
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 02-24-2007, 01:15 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Does AS In Levels Override Override AS In Mc?
I am not a programmer and am trying to deal with AS.
I have a sequential series of swf files that consist of one jpg image fading into another. the next movie begins with the last image of the preceding movie. All ten swf files are about 40k each.
I have created a master file with an empty mc into which i'm trying to rotate these movies via target. In the sequential swfs I use an action to stop the swf so that it doesn't loop. Does this stop command only affect the loaded swf or does it also stop the timeline when loaded into it?
I'm trying to get this to work and i'm try all kinds of things to get this to work. It doesn't seem like this would be a hard thing to accomplish but i'm going batty. thanks.
Right-click Override
i doubt it, but does anyone know a way to override flash's right-click menu and not just disable it, but write right-click events?
i know flash doesnt do it but maybe by loading an outside javascript call or something...
is macromedia planning on implementing this in future versions of flash? it would be a really useful feature.
ryan
Override Stop?
Hello, everyone.
Is there actionscript out there that allows a button to override a "stop()" if the movie was put into play by that specific button?
Just wondering.
Thanks in advance, everyone!
Override Mask?
Hello,
I am a bit stuck. I am attempting to change the z position of a movie clip that is embedded within two other .swfs that are all under a mask. I have attempted to use swapdepths method, but I am confused as to how I should go about doing this when the MC that I am attempting to swap is so deep. I apologize if this is unclear. Thank you for any help you might be able to offer.
A
[F8] Override Constructor
Hi there...
Okay just quick shoot...here...ok just curiousity here....from my digging and reading I know that we can't override constructor.....but might possiblity can be achieve...so I really need some shed on light from expertise people or some ideas how to achieve it...here's the my portions curiousity....
Code:
//let's say
class TestClass{
var __a:String;
var __b:Number
//==================constructor==============
function TestClass(a:String){
__a = a;
}
function TestClass(b:Number){
__b = b;
}
//==================constructor==============
}
//my curiosity is how to override constructor I mean give an options to me in order to to string params or numbers param2 either....
Code:
eg;
var test:TestClass = new TestClass("test");
var test:TestClass = new TestClass(2);
It is because my goal purposely wanna rectifying what of the datatype parameters being passing inside the class whether string or number..that's all is it possible....????
Any help are really appreciated
Override HtmlText?
I've got a class that extends TextField. I'd like to override TextField.htmlText (which is a getter/setter) so that when it is set, it automatically wraps a tag "<default>" around whatever you're setting it to.
Is this possible, or am I stuck with writing a differently-named public function to do the dirty work?
Override A Function
I have a function:
ActionScript Code:
function myClick(e:Event):void
{
timerBack.timer.stop();
timerBack.timer.start();
}
and I want to call myClick every time that I click in my buttons (I have a lot of them and donīt want to add a listener to each one)
can I override addEventListener OR MouseEvent.CLICK ??
Thanks!!
Override Question
hello;
I am learning how to extend my own custom classes;
for instance I have:
ActionScript Code:
// class A
public function a_method() : void
{ trace( "hello class A , a_method");
}
ActionScript Code:
// class B extends A
override public function a_method()
{ trace( "hello class B , a_method");
}
it works fine;
QUESTION: how can I make the class B method override BUT YET ALSO call the class A method?
thus the output should be:
hello class B , a_method
hello class A , a_method
thanks,
Shannon
Override A Variable?
I'm not sure if it's possible, but can you override a variable of a parent class like you can override a function?
I'm trying to create my own event class that can handle the target property. I have a custom imageLoader class, but when it dispatches it's loading complete event:
ActionScript Code:
dispatch(new Event("load_complete"));
and a listener picks it up, e.target = null where I would like e.target to equal the imageLoader instance that has finished loading.
Does anyone have an answer or a better way to accomplish what I am aiming for?
Override Escape Key
i want users to see a video, and if they press the esc key in the keybord, not be able to interrup it, this is done how??
tahks
Override & Different Packages?
Hello.
I've having a problem overriding a method while extending a class whose parent class resides in another package.
My desire is to create a subclass based on the super class Calendar, but located in another package.
Unfortunately I'm only able to override the 'dosomething' method if I make it public [inside Class] or putting ExtendedCalendar in the same folder as Calendar [wich I dont want to...]. Any thoughts?
package utils1 {
public class Calendar {
public function Calendar(){
dosomething();
}
internal function dosomething():void {
. . .
}
}
}
//this will give me the following error:
//"1020: Method marked override must override another method."
package utils2 {
import utils1.Calendar;
public class ExtendedCalendar extends Calendar {
public function ExtendedCalendar (){
super();
}
override internal function dosomething():void {
. . .
}
}
}
Thanks in advance,
T.
Edited: 03/18/2008 at 04:17:31 PM by Plura
Function Override ?
hello people.
I used a piece of AS from kirupa site to preload externally loaded images
Code:
this.onEnterFrame = function() {
kb = laadMc.getBytesTotal();
geladen = laadMc.getBytesLoaded();
_root.tijdbalk.stop();
if (geladen != kb) {
preloader.preloadbalk._xscale = 100*geladen/kb;
} else {
_root.tijdbalk.play();
}
};
Now my problem, I made a button with the following AS
Code:
on (release) {
_root.tijdbalk.stop();
}
But because of the function (i think) this button dont work, the "tijdbalk" does stop, but only a verry short while.
I think i need to override that funtion thats in the preloader.
Does someone knows how ?
btw, I do want to keep the stop and play actions in the preloader function, because the tijdbalk is a mc with a little AS that tells my movie to load a new image.
thx in advance.
Override Question
i have a piece of code in a layer in the timeline of course to ask a movie clip to do something... but i also have another piece of code inside this movie clip to do something as well.. what does get override if so?
thanks.
Override Constructor
Hi there...
Okay just quick shoot...here...ok just curiousity here....from my digging and reading I know that we can't override constructor.....but might possiblity can be achieve...so I really need some shed on light from expertise people or some ideas how to achieve it...here's the my portions curiousity....
Code:
//let's say
class TestClass{
var __a:String;
var __b:Number
//==================constructor==============
function TestClass(a:String){
__a = a;
}
function TestClass(b:Number){
__b = b;
}
//==================constructor==============
}
//my curiosity is how to override constructor I mean give an options to me in order to to string params or numbers param2 either....
Code:
eg;
var test:TestClass = new TestClass("test");
var test:TestClass = new TestClass(2);
It is because my goal purposely wanna rectifying what of the datatype parameters being passing inside the class whether string or number..that's all is it possible....????
Any help are really appreciated
Override A Function
I have a function:
ActionScript Code:
function myClick(e:Event):void { timerBack.timer.stop(); timerBack.timer.start();}
and I want to call myClick every time that I click in my buttons (I have a lot of them and donīt want to add a listener to each one)
can I override addEventListener OR MouseEvent.CLICK ??
Thanks!!
Is It Possible To Override Events
At the bottom of my screen I have a dynamic textField called "rollOverItem" that whenever any object receives the "rollOver" event. the text in the field changes to indicate which item is rolled over.
I don't want to have to subscribe every object to my textfield using listeners because there will be times that I don't know which things need listening to. Is there a way to make it so that every time the RollOver event is sent, a second event is automatically sent to the Dynamic Text Field?
The secondary goal of this, of course, would be to allow individual instances of objects to script their onRollOver events without affecting the fact that the dynamic text field always needs to be updated.
Override VOLUME_BAR_INTERVAL_DEFAULT
Hey Guys,
Not sure if this is super obvious yet, but I'm a big NOOB to AS3. I'm working on skinning the FLV player and doing very well but I noticed that I hate how laggy the volume mask slide is when you slide the volume handle. I know the problem but I'm a little short for answers on how to over ride it.
The FLVPlayback UiManager.as has this code:
Code:
/**
* Default value of volumeBarInterval
*
* @see #volumeBarInterval
*
* @langversion 3.0
* @playerversion Flash 9.0.28.0
*/
public static const VOLUME_BAR_INTERVAL_DEFAULT:Number = 250;
// setup timers
_volumeBarTimer = new Timer(VOLUME_BAR_INTERVAL_DEFAULT);
/**
* Determines how often check the volume bar handle location when
* scubbing, in milliseconds.
*
* @default 250
*
* @see #VOLUME_BAR_INTERVAL_DEFAULT
*
* @langversion 3.0
* @playerversion Flash 9.0.28.0
*/
public function get volumeBarInterval():Number {
return _volumeBarTimer.delay;
}
public function set volumeBarInterval(s:Number):void {
if (_volumeBarTimer.delay == s) return;
_volumeBarTimer.delay = s;
}
Heres my attempt:
Code:
/**
* Determines how often check the volume bar handle location when
* scubbing, in milliseconds.
*/
public static const VOLUME_BAR_INTERVAL_DEFAULT:Number = 100;
override public function get volumeBarInterval():Number {
return _volumeBarTimer.delay;
trace("You Changed the volume bar interval defalut");
}
override public function set volumeBarInterval(s:Number):void {
if (_volumeBarTimer.delay == s) return;
_volumeBarTimer.delay = s;
}
No luck, I don't even see my trace. There is code already overriding some of the UiManager.as code now but that was done by one of my developers, and now he is gone so that leaves me all alone.
So how can I have this code look at the volume handle position more often?
Thanks for any help in advance.
Override Protected Getter?
I have 3 classes set up. An abstract, a concrete and a utility that needs access to the concretes getter. When I try to access the property of the concrete from within the utility it throws an error.
//abstract
PHP Code:
package{ import flash.errors.IllegalOperationError; class{ protected function get left():Number{ throw new IllegalOperationError("Abstract method: must be overridden in a subclass"); } }}
//concrete
PHP Code:
package{ class extends abstract{ override protected function get left():Number{ return someVal; } }}
//utility
PHP Code:
package{ class utility{ private var concrete:abstract; public function utility(concreteClass:abstract){ this.concrete = concreteClass; init(); } private class init():void{ trace(concrete.left); //1178: Attempted access of inaccessible property left through a reference with static type abstract. } }}
//client
PHP Code:
package{ class{ public function client():void{ var c = new concrete(); var u = new utility(c); } }}
Any idea how to gain access?
How To Override The Printing Dialogue?
Can flash bypass the printing pop up dialogue and print out directly after pressing the print button in flash?
or is there an alternate way to bypass this? eg: disable the pop up feature in windows..etc
pls help..hav a very important presentation on weekend to boss ..
Any Way To Override Static Functions?
Now i bumped into something i was wondering about for a long time, maybe some of you already gave it a thought. Is there any way to override static functions of Flash top level classes? Lets take Stage or Math for example. What if we want to change Stage.addListener functionality, is there any solution to this problem?
Thanks in advance
Sappho
Can You Override EventDispatcher Methods?
I tried posting this yesterday but it never turned up on the forum..
The problem I'm having is that I can't seem to override any the EventDispatcher methods in subclasses.
I have a superclass that initializes the EventDispatcher on itself in the normal way. Then in the subclass I simply override 'addEventListener' with my own method. If I then call 'addEventListener' it just skips right past my override method and goes straight to the default event dispatcher... How come?
(If I don't .initialize Event Dispatcher in the superclass the override method works fine, so it must be something to do with the way ED initialises and works??)
Override Core Functions
just wondering if it is possible to override core functions ( in particular gets and sets ) in as3? i was wanting to modify the functionality of 'parent'
Override Play Methode
Hello
I have a class who extends NetStream, i would like override play function.
public class VideoSync extends NetStream {
//PROPERTIES
private var _nc:NetConnection;
//CONSTRUCTOR
public function VideoSync()
{
_nc = new NetConnection();
_nc.connect(null);
super(_nc);
init();
}
public override function play(... arguments):void {
trace(arguments)
super.play(arguments);
}
}
When i try to play my video
var ns:VideoSync = new VideoSync();
ns.play("video.flv");
var vid:Video = new Video();
vid.attachNetStream(ns);
addChild(vid)
the video didn't play
Please help me :(
thanks
Edited: 06/03/2007 at 06:07:54 AM by bolo972
Sounds SetVolume Override Each Other
Hi -
I have a swf that brings in multiple "child" mcs. The main (parent) timeline has a sound var on it and the children mcs have their sounds. If I set both setVolumes to 100 - no problem. But if I lower the child's sound to 20 - the parent's sound is also lowered.
What am I doing wrong here? What's the correct way to set this situation up? Ideally I'd like to declare all the sounds in the parent action layer and set all the volumes from one place - but that silenced the child sound. In one experiment, the parent sound got quieter each time I used it after using the child sound.
What is the "once and for all" way to do this?
TIA some explanation.
JL
Attach Code
// this code on the main timeline (actionscript layer) -
// this sound is triggered by btn/mcs with an onRelease. These btn/mc's onReleases also attach child mcs.
var whoosh_sound:Sound = new Sound();
whoosh_sound.attachSound('whoosh2');
whoosh_sound.setVolume(100);
// this is on the child mcs actionscript layer and is triggered when a radio btn is clicked
var radioClick:Sound = new Sound();
radioClick.attachSound('radioClickSnd');
radioClick.setVolume(10); // why does this setVolume control both sounds?
Function Extension Vs Override
Hi everybody,
First of all, I know it's possible to override the function and from there to call the function in the parent class.
This is just to let you know that this is not a topic based on a whim or fancy.
My question is, is there anybody out there who, like me, would like to have an easier way of extending functions in class inheritance?
Let me give an example:
Suppose I have superclass A. I use this class as the base class for all my buttons, so I want it to listen to mouseover and mouseout events. Class A extends MovieClip, because I want to retain maximum flexibility in my buttons (e.g. adding an animation in some subclass). As defined in class A, the mouseover event function defaults to gotoAndPlay(2), and the mouseout function defaults to gotoAndPlay(1).
So what if i have classes B and C, which extend from A. Class B has a textfield in it, which should change color on mouseover and mouseout, while class C has a textfield which should change size. (Just as an example.)
I don't want to listen to mouse events in each class, once should be enough. So I need to extend the mouseover listener function in both classes B and C. The current way to do this:
protected override function mouseOver(event:MouseEvent):void {
super.mouseOver(event);
this.button_text.textColor = 0xFFFFFF;
}
but what i would like is:
protected extension function moseOver(event:MouseEvent):void {
this.button_text.textColor = 0xFFFFFF;
}
This seems like an unnecessary feature, but please picture a project in which class A is the superclass for a host of different types of buttons, which each have different inheritance chains, depending on what they do, and which behaviors they share. Somewhere down the line, I might have a class whose two immediate parents do not need to extend the mouseover behavior. This would imply that the code would be:
protected override function mouseOver(event:MouseEvent) {
super.super.super.mouseOver(event);
}
And that's the point where I thought of asking what the rest of the world thinks about it.
I hope to read some interesting reactions.
Function Extension Vs Override
Hi everybody,
First of all, I know it's possible to override the function and from there to call the function in the parent class.
This is just to let you know that this is not a topic based on a whim or fancy.
My question is, is there anybody out there who, like me, would like to have an easier way of extending functions in class inheritance?
Let me give an example:
Suppose I have superclass A. I use this class as the base class for all my buttons, so I want it to listen to mouseover and mouseout events. Class A extends MovieClip, because I want to retain maximum flexibility in my buttons (e.g. adding an animation in some subclass). As defined in class A, the mouseover event function defaults to gotoAndPlay(2), and the mouseout function defaults to gotoAndPlay(1).
So what if i have classes B and C, which extend from A. Class B has a textfield in it, which should change color on mouseover and mouseout, while class C has a textfield which should change size. (Just as an example.)
I don't want to listen to mouse events in each class, once should be enough. So I need to extend the mouseover listener function in both classes B and C. The current way to do this:
protected override function mouseOver(event:MouseEvent):void {
super.mouseOver(event);
this.button_text.textColor = 0xFFFFFF;
}
but what i would like is:
protected extension function moseOver(event:MouseEvent):void {
this.button_text.textColor = 0xFFFFFF;
}
This seems like an unnecessary feature, but please picture a project in which class A is the superclass for a host of different types of buttons, which each have different inheritance chains, depending on what they do, and which behaviors they share. Somewhere down the line, I might have a class whose two immediate parents do not need to extend the mouseover behavior. This would imply that the code would be:
protected override function mouseOver(event:MouseEvent) {
super.super.super.mouseOver(event);
}
And that's the point where I thought of asking what the rest of the world thinks about it.
I hope to read some interesting reactions.
Getting Stop(); To Override SetInterval?
I have a movie that goes through a spiel and I want to be able to stop it then hit play and have it continue. Easy enough IF the movie just goes straight through. But what mine does is pauses at certain places to make way for some spoken word (to be added later) using setInterval.
My problem is (seems to be) if I hit my stop button while it's doing it's 1.5 second pause, then the stop button gets ignored.
Here's the swf: (around 300k)
http://ww.pseudodigm.com/testing/automated.swf
here's the fla: (about 3mb)
http://www.pseudodigm.com/testing/automated.fla
I really appreciate the help (this site and these forums have REALLY helped me. You should have seen my flash BEFORE! ; ) )
-Rick
Can't Override Array Methods
Hello everyone. I have a couple of concerns with this Array subclass I'm writing (it's not finished and please do not ask me why I didn't use ObjectProxy or Proxy as the base class).
Code:
package com.cation.rgd.utils {
public dynamic class RectArray extends Array {
override AS3 function indexOf(searchElement:*, fromIndex:int = 0):int {
// Return the index of an element WHEN the array is straightened
return straighten().indexOf(searchElement, fromIndex);
}
override AS3 function join(sep:* = ","):String {
sep = Object(sep).toString();
// Create an empty string
var string:String = "";
for (var i:Number = 0; i < length; i++) {
if (this[i] is Array) {
for (var j:Number = 0; j < this[i].length; j++) {
// If array, iterate once and obtain column elements
string += this[i][j].toString();
if (j != this[i].length - 1) {
// If not at end of array, put separator
string += sep;
}
}
if (i == length - 1) {
// If at end of array, make a newline
string += "
";
}
}
else {
// If not array, string the element and make a newline
string += this[i].toString() + "
";
}
}
return string;
}
override AS3 function lastIndexOf(searchElement:*, fromIndex:int = 0x7fffffff):int {
// Return the last index of an element WHEN the array is straightened
return straighten().lastIndexOf(searchElement, fromIndex);
}
}
}
I've cut out the other methods and properties (they do exist: RectArray.straighten() returns an Array, just so you know) because they aren't the trouble-makers.
According to three AS3 references (the Flex 2, Apollo Alpha, and Flash CS3), the method Array.join takes one argument, sep:* with no default value (technically, the default value is a comma, but it's not implemented as a default value, at least that's what it looks like on the references).
So, naturally when I override it, I'm supposed to keep the same arguments and when I did, Flash would not compile it saying it was an incompatible override.
I added the default value of "," and it compiled (in fact, any string worked). So, obviously there's something different about the internal implementation of the actual method...either that or it's just me.
Second, I can't override Array.indexOf and Array.lastIndexOf and I can't figure out why. I've tried it in Flash and the Flex SDK and it doesn't work no matter what I do.
AIR Is It Possible To Override The Exit() Function?
I'm wanting to display a splash asking the user if they really want to exit when the NativeApplication.nativeApplication.exit() method is called. I'm listening for Event.EXITING but can't seem to override the actual exit() function.
AS3 Can Not Override Component's Parameters
hi,
i added some buttons, check boxes and combo boxes into a MovieClip, than i'd tried to set "enabled" properties of components to "false". But when i tested flash, component's, properties' wasn't changed. So i tried to delete "enabled" parameter from "component defination".
Combo box's and check box's parameters r deleted as well but button. Now combo boxes and check boxes working fine but how can i fix button, any idea?
[AS3-Flash CS4]
(P.S: when i added buttons with AS3 they're working fine but i don't want to add ton's of buttons dynamicly, one by one)
Getting Stop(); To Override SetInterval?
I have a movie that goes through a spiel and I want to be able to stop it then hit play and have it continue. Easy enough IF the movie just goes straight through. But what mine does is pauses at certain places to make way for some spoken word (to be added later) using setInterval.
My problem is (seems to be) if I hit my stop button while it's doing it's 1.5 second pause, then the stop button gets ignored.
Here's the swf: (around 300k)
http://ww.pseudodigm.com/testing/automated.swf
here's the fla: (about 3mb)
http://www.pseudodigm.com/testing/automated.fla
I really appreciate the help (this site and these forums have REALLY helped me. You should have seen my flash BEFORE! ; ) )
-Rick
How To Override Embedding Parameter?
hello all,
i have a flash movie and the rightclick menu of this movie is disabled with actionscript inside the flash.
and i want this menu to be shown so i added
<param name="menu" value="true">
to the embed html tags but the menu is still disabled.
how can i override the parameter in the actionscript by a html code outside the flash?
Override Nested Mc Properties?
I couldn't find this in the archives, so....
I'm trying to set the property of a targeted mc to a certain height and width. I've created an "empty" movie clip with the right height and width dimensions, but it still seems to inherit it's parents mc dimensions!!!
My question is there a way around this? That is when I loadmovie(and external .swf) into the "empty" mc(which is nested inside another mc), I want it to get the same properties as the original .swf(which is actually a quick time movie ala sorenson squeeze) to .swf).
Thanks anyone who can help,
Brandon
Brandon Tisherman
Designer/Web Developer
Web Blends
www.webblends.com
Override Url Embedded In Swf Banner Ad
Is there any way to override (in the HTML) the url that is specified in the call to getUrl() within a SWF?
We run banner ads on our site and have received some swf files from an advertiser. They put in their own click-to url, but we need the url to go somewhere else so we can track the click event, adn then redirect to the advertiser's link.
If there is not a way to override their embedded url, what is the standard practice for this situation?
Greetings,
Dragonwell
Override The Math Class In AS3 ?
Last edited by jacquejo : 2006-08-18 at 08:10.
Hello,
In AS3, the Math class is final, so she cannot be subclassed.....
But i wan't override the Math.random() function.
In AS2, you can make this random(6) to have a number between 0-5.
In AS3, you must make Math.floor(6*Math.random()).
Too long !
Any chance to ovveride the Math.random() function to Math.random(n) , with n a number ?
i try this but no work :
ActionScript Code:
package{
public dynamic class Math2 extends Math {
public function Math2(){
trace(this)
}
AS3 override function random(n:Number):Number{
trace("ok")
}
}
}
Thanks
Any Way To Override Maximum Stage Width?
I have a setup already set up in Flash where a number of images load left-to-right, based on data loaded from a plain text file. I then put the whole document into an i-frame.
The problem is the 2880 pixel limit to Flash's stage size - I sometimes have more images than will fit on the stage. Is there any way to override the maximum stage size limit?
Prototype + Override...mo Proto' Mo Problems
I'm working on a wrapper class to handle some movieclip interfacing and I want to make it as seamless as possible. To that end, I used an override on the addChild method to let the outside world communicate directly to the wrapped movieclip, but I have one instance when I need to add the child to the wrapper - and that's the rub.
I need to override addChild but I also need to add a child to the class first...here's some pseudo-code of what I'm thinking right now:
PHP Code:
private var child:MovieClip = new MovieClip();
public override funciton addChild(d:DisplayObject):DisplayObject{
return(child.addChild(d));
}
// ...
// make addChild act normally
this.addChild(child);
// route addChild back to the override function
And before the admonishments flood in Yes, I know this is your classic "bad idea" I just want to see if it's possible.
Flash Can't Override A Method In The Same Class?
in JAVA you can do it.. but not AS 2?
like so.
Code:
class A {
function alert() {
trace("YIKES");
}
function alert(incomming) {
trace(incomming);
}
}
i'm getting this error...
The same member name may not be repeated more than once.
Is There A Trace Override For Loaded Content?
I am loading in an outside company's swf that is incredibly verbose... I find that when I want to trace out information from my own swf's I have to do these ugly code blocks like the following so I can find it in the chatter that is coming out of their swf:
ActionScript Code:
trace('#############');
trace('My trace information');
trace('#############');
I have asked that they include a way to either show or silence the trace calls from their swf, but that just goes unanswered. Does anyone know of a way I can tell flash to pay no attention to the loaded swf's trace calls?
How To Override SWF AutoPlay Parm @ Runtime
I'm trying to do what seems pretty simple, but I can't for the life of me understand why it's not working.
If have an SWF that has the autoPlay parm in Flash set to "true". In DreamWeaver, I set the Autoplay property for the SWF file to "false" (i.e. uncheck the Autoplay checkbox in the property inspector). When I run the html, the file plays automatically, ignoring the object <param name="play" value="false" AND embed play="false" settings. The opposite is also true (i.e. SWF set to false, html set to true). It looks to me anyway, like the settings are always whatever is in the SWF and the runtime html is ignored.
Believe me there's a good reason I need to so this. I need to always play the movie, unless a certain situation is not true at runtime, then I don't want to auto play the movie and make the user press the Play button.
Any help would be greatly appreciated. Thx.
Error #1023: Incompatible Override.
I need some help here. The method that I am overriding seems to be incompatible. Maybe I am missing something. Could someone take a look at this error and my code? please.
Error #1023: Incompatible override.
override protected function draw(event:Event = null):void {
ReferenceError: Error #1065: Variable ClockTest is not defined.
Attach Code
/**
*
* ABSTRACT METHOD TO BE OVERRIDDIN
*
**/
protected function draw(event:Event):void {
}
/**
*
* OVERRIDE METHOD
*
**/
override protected function draw(event:Event = null):void {
var time:Time = _data.time;
// Set the rotation of the hands based on the time
// values.
_hourHand.rotation = 30 * time.hour + 30 * time.minute / 60;
_minuteHand.rotation = 6 * time.minute + 6 * time.second / 60;
_secondHand.rotation = 6 * time.second;
}
Strange Extend And Override Errors
So i've got a strange problem with AS3. I'm trying to create a class that extends UIComponent. When I publish my FLA that uses this class I get an error saying that it can't find the definition for the base class UIComponent. If I change this to Sprite instead it appears to work but then tells me that my draw() method marked as override must override an existing draw method. So it would it can't find the UIComponent class and it doesn't see there is an overridable draw() method in the Sprite or UIComponent class. Whats going on? Is Flash compiler bugged?
Attach Code
package MyPackage
{
import fl.core.UIComponent;
public class MyClass extends UIComponent
{
override protected function draw():void
{
super.draw();
}
}
}
//// IN THE FLA FILE ////
var mClass:MyClass = new MyClass();
addChild(mClass);
Character Position Or Input Override
I'm kind of new to flash, so bear with me if this is a stupid question:
I want to know what character in a dynamic text field is closest to a given position. That is apparently possible with static fields through TextSnapShot, but I don't see how to do it with dynamic fields.
The problem I am trying to solve is to intercept whatever key the user presses and add a different character to the dtf (1-1 mapping between what they press and what I show). The snapshot-style position would be useful for making a pretend cursor on a pretend input text field, then calling replaceText based on the dtf where that cursor is.
Is there a way to do that? I think I could do it with a separate text field for each character and a global String to store the full variable, although I'm not sure how I will know the "nearest character" for the cursor in that model.
Thanks for the help.
AS3: Override Setters Getters Dilema
In AS2 my class (which extended the MC) had setters and getters for x, y, z and would then make calculations and set the instance's _x, _y values based on what I set as x, y, & z. It worked beautifully.
In AS3, I am extending Sprite. Now I had planned to use the same getter and setters, but since Adobe/MM deprecated the _x, _y props for x, y (which I am glad they did), it presents a new problem.
How in the hell can I do this:
ActionScript Code:
public function set x (newValue:Number):Void { this.x = calculateNewX (newValue):Number; //used to be this._x = calculateNewX (newValue):Number;}
Maybe the answer is painfully obvious such as just reverse your desired accessors to _x, _y, _z. Well darnit, I would like not to do that. Any other suggestions.
[AS2] Creating _global Objects (-or- Key Override)?
I am trying to resolve a problem with key captures on several layers of a project (actually several projects, a loader and a player with button emulation...) Anyway, the problem is that I have a player, similiar to a portable phone and I need to emulate keypresses on children SWFs. I don't think I can force the Key object to fire off a onKeyDown or onKeyUp event. If I can, that would be my solution.
Thinking that I can't force fire a Key Object event, I went about making up a new class to relay key events. I need to do this to add in functions and functionality to mimic key events. Instead of the child SWFs listening to the Key object, they would have to listen to my KeyCapture Object. The only thing is, I don't know how to create a base _global object, like Key in _global scope and only one shared instance of this. I want them to be able to type KeyCapture.addEventListener(this); and listen for this object to fire them keycodes. I can then implement my own functions on this KeyCapture object to relay artificial keystrokes and the child objects wouldn't be able to distinguish between a Key event and my KeyCapture event. The KeyCapture Object would relay all normal Key events, as well as fire it's own Key events.
Of course, if anyone knows of a way that I can force the Key object to trigger one of it's events, that may solve all my issues.
I would like to know how to create a base object though (like Key) if possible.
Error #1023: Incompatible Override.
override protected function draw(event:Event = null):void {
ReferenceError: Error #1065: Variable ClockTest is not defined.
the code is from <<Advanced Actionscript 3.0 With Design Patterns>>
ActionScript Code:
/** * * ABSTRACT METHOD TO BE OVERRIDDIN * **/ protected function draw(event:Event):void { } /** * * <b>OVERRIDE</b> METHOD * **/ <b>override</b> protected function draw(event:Event = null):void { var time:Time = _data.time; // Set the rotation of the hands based on the time // values. _hourHand.rotation = 30 * time.hour + 30 * time.minute / 60; _minuteHand.rotation = 6 * time.minute + 6 * time.second / 60; _secondHand.rotation = 6 * time.second; }
wondering any one can help? thanks.
|