Class extending MovieClip has innacurate this.x/this.y values

I would love if someone could take a look at the code below.  When you do, you'll see that the movieclip should obviously be at position (0, 0) on the stage.  However it appears at (25, 5)!  if I leave in the original "this.x = xx;", then it appears at (50, 5).  If I also leave in "this.y=yy;" then it appears at (50, 10).
Any ideas what's happening?  I feel like I'm doing something extremely dumb.
Thanks!
// actionscript in frame 1:
     var button:Btn = new Btn(showUpgrade, 25, 5, "Show", true, 5);
     addChild(button);
     trace(button.x.toString()); // prints 0
// Btn class
package  {
     // imports here
public class Btn extends MovieClip {
             // global vars here
     public function Btn(cback:Function=null, xx:Number=0, yy:Number=0,  lbl:String="Button", manualButton:Boolean=false, wdth:Number=0,  hght:Number=0) {
              trace(this.x.toString());  // prints 0
         this.x = 0;
              trace(this.x.toString());  // prints 0
         this.y = 0;
             // other irrelevant code below

Hi,
In your button class you're tracing values before they are set - so it prints defaults which have value of 0 I think.
If you trace values after they are assigned you should have different readings, see:
package
     import flash.display.MovieClip;
     public class MyButton extends MovieClip
          public function MyButton(callback:Function=null,
                                             xValue:int=0,
                                             yValue:int=0,
                                             label:String="Button",
                                             isManual:Boolean=false,
                                             widthValue:Number=0,
                                             heightValue:Number=0)
               super();
               trace(this.x+":"+this.y);
               this.x = xValue;
               this.y = yValue;
               trace(this.x+":"+this.y);
var btn:MyButton = new MyButton(showUpgrade, 25, 5, "Show", true, 5);
addChild(btn);
trace("btn.x:"+btn.x+":btn.y:"+btn.y);
at least for me it traces:
0:0
25:5
btn.x:25:btn.y:5
the first 0:0 is expected as they are traced in constructor before assigning new values (and before object is added to stage btw),
regards,
Peter

Similar Messages

  • I created a class file , if i execute this class file it has to be always o

    i created a class file , if i execute this class file it has to be always on top if i open any other programms or applications then also this class file application has to show me on the screen top , i meas ti has to show me first and behind all applications which i opend other applications
    How to do this please help me
    bhaskar

    It sounds like you might be able to write a .bat script to run the application, create a desktop icon for that and set its properties so it runs in the background.

  • Error 1119 when class extends another class that extends movieclip

    hiya
    i came across this problem and i have no clue why it's happening. basically, consider 2 nested movieclips on the stage, something like stage -> main -> filler.  both movieclips have instance names (main and filler).
    in the library, i set main to export for actionscript, using class A:
    package {
        import flash.display.MovieClip;
        public class A extends MovieClip {     
            public function A ():void {
                trace ('construct A');
                trace (this.filler); // should trace [movieclip] etc
    it works fine. now i change it's export settings to use class B, that extends A, and it breaks:
    package {
        import flash.display.MovieClip;
        public class B extends A {
            public function B ():void {
                trace ('construct B');
    this throws an error 1119: Access of possibly undefined property filler through a reference with static type A.
    can anyone give me a hint on that, as it works with class A, but not B extending A? i understand it was meant to work?
    many thanks

    afaik, if you dont declare super(), flash will make a call for you (but best practice is to call it always).
    but i found the "solution" in another forum.
    it seems that flash implicitly generates variables if you have instance names/symbols on the stage. there is an option to disable that under publish settings -> Actionscript version -> Settings -> automatically declare stage instances. by disabling that, we were able to declare public var filler:MovieClip; on class A, and that worked.
    although, that solution doesnt look attractive to me. the other solution posted on another forum was to make calls to this ["filler"] instead of this.filler. that seems to work fine. i guess it has to do with the automatic variable generated thing.. who knows?
    i hope that helps someone else too

  • AS3.0: How to extend a class that extends MovieClip

    When I try to set the base class of a library symbol to a
    class that doesn't DIRECTLY extend MovieClip, but instead extends
    another class that DOES extend MovieClip, it's disallowed, saying,
    "The class 'Whatever' must subclass 'flash.display.MovieClip' since
    it is linked..."
    Is this just a validation bug in the property windows, only
    checking one class deep into the inheritance hierarchy? Because the
    specified class does extend MovieClip, just two levels in instead
    of one. Is there a fix for this? Or must library symbols always
    directly extend MovieClip? If so, why?

    Which classes from flash.display have you imported. Just
    because a class extends another doesn't mean that it inherits all
    of its properties. Saying a class extends sprite doesn't give you
    access to all of it's properties, members and display unless you
    first import flash.display.* or flash.display.Sprite. If you aren't
    already importing flash.display.*, try importing
    flash.display.MovieClip and see what happens...

  • Surely SOMEONE HAS SEEN THIS BEHAVIOR???  Distorted Add Remove control!

    Lots of people have VIEWED this posting since I first posted it on Nov 30th,
    but I can't believe that NOBODY ELSE HAS SEEN THIS BEHAVIOR!
    So here it is again....
    Can anyone tell me why on some pc's my Add Remove list control appears stretched out - that is, the right-side 'selected' list box will extend to the left covering the add/remove buttons and the same 'selected' box is only half drawn from the left side (right side missing), including the title being truncated, and the title is then duplicated to the right in its entirety. (It is hard to describe but I can provide a screenshot if needed).
    As soon as an item is selected or de-selected, it re-adjusts itself to normalcy!
    It seems to be a browser independent problem which ONLY happens on SOME pc's and NEVER on others! This leads me to suspect an out-of-date jar or class file on the local pc but I can't seem to find anything inconsistent.
    CAN ANYONE HELP?! It is preventing us from putting this page into production and I would hate to have to write my own replacement, as it would take more time than we have.
    Thanks in advance for your assistance,
    <-j->
    PS - I have tried REPEATEDLY to add some Duke Dollars to this submission to no avail! The link just goes to a Pge Not Found or something similar

    As I mentioned in my original post, it seems to be a non-browser related problem - that is it shows up MOSTLY in IE, but has been seen also in Firefox.
    Any suggestions on what further to check would be GREATLY APPRECIATED!

  • HT1567 I can't import an audio cd to itunes to add to my library. I ran a diagnostics test and it had a red light next to: Unable to access audio cd. I am wondering if anyone else has had this problem and if there is an easy solution?

    I can't import an audio cd to itunes to add to my library. I ran a diagnostics test and it had a red light next to: Unable to access audio cd. I am wondering if anyone else has had this problem and if there is an easy solution?

    Satellite L675-S7113 Specifications (PSK3AU-07C02S)
    Satellite L675-S7113 Support Page
    rwls wrote:...since I got it 3 years ago I've been unable to burn an audio CD from ITunes or Windows media although it worked once after the computer had been shut off for awhile..and didn't find the problem until after my warranty had expired...
    From your statements above, it sounds like you never tried to burn a CD for at least the first year that you owned the laptop, as it had a one year warranty on it. While you might have used it frequently to install software,  play DVDs, Blu-Ray disks, etc, that's unclear from your statements. Nonetheless, it might just be dirty-dusty. So, before deleting-uninstalling any software, and given they're cheap, try a CD-DVD Cleaner Disk first and see if that resolves your problems.
    Let us know what happens. Good luck.
    Mike

  • For some reason the Apple ID window in iTunes  and App Store now seems to have a character number constraint. As a result I am unable to enter the final few characters of my Apple ID which I have had for many years. Does anyone know what has caused this?

    For some reason the Apple ID window in iTunes and App Store now seems to suddenly have a character number constraint which prevents me using my 29 character Apple ID. As a result I am unable to enter the final few characters of my Apple ID which I have had for many years. Does anyone know what has caused this?

    You need to ask Apple for assistance with getting back into your old ID. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to resolve this issue through the Account Security team, fill out and submit this form.
    (118441)

  • When ever I try to watch any video, from a link or YouTube say, using Firefox, I get a message 'An error as occurred. Please try again later'. It has been this way for some weeks. I don't have this problem using Safari or Opera.

    When ever I try to watch any video, from a link or YouTube say, using Firefox, I get a message ‘An error as occurred. Please try again later’. It has been this way for some weeks. I don’t have this problem using Safari or Opera.

    I believe that our “Werbung problem” adds an additional second hyperlink to the pop-up window. This second link is activated whenever you trigger a saved hyperlink to a Mail.com site.
    I had the same problem and eliminated it by deleting all bookmarks, hyperlinks and automatic links that take firefox to a mail.com address. So I just deleted all bookmarks I had saved for mail.com. I also changed my home page link because it also went to my email at mail.com. I then did a warm boot, opened firefox and re-saved my bookmarks and homepage to the desired addresses. Good luck.

  • HT1339 ipod not recognized by my computer, it says "Windows has stopped this device because it has reported problems. (Code 43)" please help

    please help...
    my computer is not recognizing my ipod classic gen 5. it shows the sad face then i did the basic troubleshooting until logo comes out...
    still my computer is not recognizing my ipod.. it still says "Windows has stopped this device because it has reported problems. (Code 43)"

    See here: iPod displays a sad iPod icon
    Note that it's often a good sign of a hardware issue with the iPod's hard drive meaning the iPod will need to be serviced or replaced.
    B-rock

  • I have sent my iPod back for servicing because it is cracked, with some dispute with Apple I have managed to get a brand new iPod Touch. Just wondering if anyone has had this problem how long did it take from "Replacement Product Pending" to get bck to UK

    I have sent my iPod back for servicing because it is cracked, with some dispute with Apple I have managed to get a brand new iPod Touch. Just wondering if anyone has had this problem how long did it take from "Replacement Product Pending" to get back to the UK

    Not really. Is say "pending"
    pend·ing 
    /ˈpendiNG/
    Adjective 
    Awaiting decision or settlement.
    Preposition
    Until (something) happens or takes place: "they were released on bail pending an appeal".
    Synonyms
    adjective. 
    pendent - undecided - unsettled - outstanding - pendant
    preposition. 
    during - until - till - to

  • My ipod nano isn't syncing when I try and change the setting in manually, but is however syncing when I launch the itunes by plugging it in. I'm wondering if anyone has had this issue and/or had been able to fix the problem?

    My ipod nano isn't syncing when I try and change the setting in manually, but is however syncing when I launch the itunes by plugging it in. I'm wondering if anyone has had this issue and/or had been able to fix the problem?

    Do you have any better luck with that if you update to iTunes 10.6.1.7?
    From the notes for the release:
    iTunes 10.6.1 provides a number of improvements, including:
    • Fixes several issues that may cause iTunes to unexpectedly quit while playing videos, changing artwork size in Grid view and syncing photos to devices.
    • Addresses an issue where some iTunes interface elements are incorrectly described by VoiceOver and WindowEyes.
    • Fixes a problem where iTunes may become unresponsive while syncing iPod nano or iPod shuffle.
    • Resolves an ordering problem while browsing TV episodes in your iTunes library on Apple TV.
    http://www.apple.com/itunes/download/

  • How do I control my airport extremes/time capsules w/airport utility over the internet without mobile me? iCloud has disabled this function.

    How do I use airport utillity with Time Capsule(or any airport extreme) over the internet without mobile me? iCloud has disabled this function. The mac's that I have not upgraded to icloud still see my routers over the internet with mobile me enabled.  Are these routers obsolete now or will there be a firmware update to use icloud?

    i want to do the same. i tried entering my @me.com account and does not work, but if I tried to go to icloud.com and using my @me.com works
    why?
    does the Airport express needs to be upgraded as well

  • When going to my hometown paper's site I get a dropdown banner that says Firefox has prevented this site from reloading ,but when I click on the allow button you have on the banner nothing happens so why is the button there?

    When I go to the local paper's from Elmira,NY and some other sites I get a drop down banner at the top of the page that tell me Firefox has prevented this page from reloading,but when I go to the allow button that you put on the right side of the banner and click on it the banner goes away and then it comes right back. It will come back every time you click allow until I click on the x box. So I want to know why is the allow button there if it does nothing?

    Click the Firefox button, go to Options | Options | Advanced and in the General tab, remove the checkmark from "'''Warn me when websites try to redirect or reload the page'''".
    You won't get that dropdown banner anymore afterwards.

  • TS1424 My Apple ID has been disabled, it won't let me updated my previous purchases. No reason for why it has been disabled or how to enable it again. I reset my password, security questions and billing info. Nothing- Anybody has seen this before?...

    My Apple ID has been disabled, it won't let me updated my previous purchases. No reason for why it has been disabled or how to enable it again. I reset my password, security questions and billing info. Nothing… I even called Apple SUpport 1-800 # and they said they can't help me...Anybody has seen this before?...

    You need to contact itunes support.
    http://www.apple.com/support/contact/
    There is NO telephone support for itunes.  Use the link above.

  • I logged in to pay my bill via the app yesterday and my stored form of payment was gone. Since I wasnt at home I didnt have access to my checking account now nor a credit card. This is the first time in 14 years that my online account has had this issue a

    I logged in to pay my bill via the app yesterday and my stored form of payment was gone. Since I wasnt at home I didnt have access to my checking account now nor a credit card. This is the first time in 14 years that my online account has had this issue and NO my stored card is not expired. My payment is now going to be late and i was going to get a new phone oin the Edge plan too. Am I going to get charged a late fee and does tgis affect my eligibilityafter 14 years of on time payments! And why did you wipe out my stored payment info?

    Ratwurkz,
    Oh my goodness! That is not what we like to hear. Were you able to log in online not through the My Verizon App? Did it show the card available in there? Is this the same card that you have used for past payments? Let's look a little closer.
    RobinD_VZW
    Follow us on twitter @VZWSupport

Maybe you are looking for

  • Can I use iCloud just for my PC?

    I do not have any IOS devices but I was hoping to use iCloud to back up all my iTunes. But when I try to set-up iCloud I cannot because my valid Apple login is not a iCloud account. From what I can see I need to download iCloud onto another IOS devic

  • Video out of sync in Final Cut Express... but in sync everywhere else!

    'm working on making one video that is composed of two camera angles of the same thing. So, I have two video tracks in Final Cut Express, one for the side view, and one for the main view. Both videos are Quicktime Movies (.mov extension). Here are th

  • Reconcilition account in MIRO

    I had maintain alternate reconcilition account "1000002" for a reconcilitaion account "1000001" . now i am doing MIRO for a vendor to which reconcilitaion account "1000001" is maintain in vendor master. In detail tab in MIRO this reconcilitaion accou

  • Inter-Company Billing Error.

    Hi, I am getting an error in vf01 while using billing type as IV. "Company Code is not defined" kindly provide your inputs on this. Regards Yepuri

  • Unable to connect to wireless network after software update

    on updating the software on my Ipad 3 I am unable to connect to my office wireless network