Clearing Graphics and Sprites problem

Thanks to Andrei1 for his help previously. Another problem in the same application. Just having problem clearing sprites and graphics. Commented out the clear statements below. Ends up showing nothing. Do I need to create a separate function for initial and then updated values?? Thanks in advance for any help. Hope the code is not to long.

I think you need to listen to CHANGE event on user input items. Events may be different though:
ComboBox - CHANGE,
InputText - has CHANGE or TextEvent.TEXT_INPUT - depending on your needs
CheckBox and RadioButton dispatch CHANGE event
So the code can be as following:
import flash.display.Sprite;
import flash.geom.Point;
stop();
//Set up global variables
//Set initial selectable Values
rbMonth.selected = true;
rbRisk1.selected = true;
rbYears10.selected = true;
// declare color of graph
var graphColor:uint = 0xCC6600;
//Set variable Group Names
var timeValue:Object = rbMonth.group;
var riskValue:Object = rbRisk1.group;
var yearsValue:Object = rbYears10.group;
var answerCurr:Array = new Array();
// it may array of points
var points:Array = new Array();
var gr:Graphics = this.graphics;
gr.lineStyle(1, graphColor, 0.5);
var i:int = 0;
// no need for enter frame event listeners
//addEventListener(Event.ENTER_FRAME, initSum);
//addEventListener(Event.ENTER_FRAME, drawPoints);
// add change or other corresponding events to UI
num2.addEventListener(Event.CHANGE, drawPoints);
num1.addEventListener(Event.CHANGE, drawPoints);
timeValue.addEventListener(Event.CHANGE, drawPoints);
riskValue.addEventListener(Event.CHANGE, drawPoints);
yearsValue.addEventListener(Event.CHANGE, drawPoints);
// initial settings
initSum();
//Calculate initial set values
function initSum(event:Event = null):void {
     var Dinit:Number = num2.value;
     var Pinit:Number = num1.value;
     var Cinit:Number = (timeValue.selectedData) * Dinit;
     var Rinit:Number = riskValue.selectedData;
     var Yinit:Number = yearsValue.selectedData;
     //Compound Interest P = Starting principal, C = contributions/year, R = interest rate as decimal.
     //P(1+R)Y + C[((1+R)Y+1 - (1+R))/R]
     //Formula converted intoActionscript = P*(Math.pow((1+R), Y)) + C*(((Math.pow((1+R),Y+1)) - (1+R))/R); break formula into separate parts
     var firstPartInit = Pinit * (Math.pow((1 + Rinit), Yinit));
     var secondPartInit = Math.pow((1 + Rinit), Yinit + 1).toFixed(2);
     var thirdPartInit = 1 + Rinit;
     var answerInit = firstPartInit +Cinit * ((secondPartInit - thirdPartInit) / Rinit);
     var answerInitFinal = answerInit.toFixed(0);
     commaCoderInit(answerInitFinal);
     // first call to draw points
     drawPoints();
//Format initial end result with commas
function commaCoderInit(yourNum):String {
     var numtoString1:String = new String();
     for (i = 0; i < yourNum.length; i++) {
          if ((yourNum.length-i)%3 == 0 && i != 0) {
               numtoString1 += ",";
          numtoString1 += yourNum.charAt(i);
     return result1_txt.text = numtoString1 + " €";
//Draw Current points on graph
function drawPoints(event:Event = null):void {
     var Dcurr:Number = num2.value;
     var Pcurr:Number = num1.value;
     var Ccurr:Number = (timeValue.selectedData) * Dcurr;
     var Rcurr:Number = riskValue.selectedData;
     var year:Number =  yearsValue.selectedData;
     var firstPartCurr:Number;
     var secondPartCurr:Number;
     var thirdPartCurr:Number;
     //Calculate Max value and ratio
     var firstPartMax:Number;
     var secondPartMax:Number;
     var thirdPartMax:Number;
     var answerMax:Number;
     var ratio:Number;
     var firstPartMax:Number;
     var secondPartMax:Number;
     var thirdPartMax:Number;
     var answerMax:Number;
     var ratio:Number;
     // point sprite
     var point:Point;
     //Create value loop array
     for (i = 0; i <= yearsValue.selectedData; i++) {
          firstPartCurr = Pcurr * (Math.pow((1 + Rcurr), i));
          secondPartCurr = Math.pow((1 + Rcurr), i + 1).toFixed(2);
          thirdPartCurr = 1 + Rcurr;
          answerCurr[i] = firstPartCurr + Ccurr * ((secondPartCurr - thirdPartCurr) / Rcurr);
          //Calculate Max value and ratio
          firstPartMax = Pcurr * (Math.pow((1 + Rcurr), year));
          secondPartMax = Math.pow((1 + Rcurr), year + 1).toFixed(2);
          thirdPartMax = 1 + Rcurr;
          answerMax = firstPartMax + Ccurr * ((secondPartMax - thirdPartMax) / Rcurr);
          ratio = (answerMax).toFixed(0) / 250;
          // now it is Point - not Sprite
          point = new Point(25 + i * (550 / yearsValue.selectedData), 675 - (answerCurr[i] / ratio));
          points.push(point);
     drawLines();
//Draw initial lines on graph
function drawLines():void {
     gr.clear();
     gr.moveTo(points[0].x, points[0].y);
     for (i = 0; i < points.length; i++) {
          gr.beginFill(graphColor);
          gr.drawCircle(points[i].x, points[i].y, 3);
          gr.endFill();
          gr.lineTo(points[i].x, points[i].y);

Similar Messages

  • Clearing mac and DNS problems

    Hi there,
    let me know if this should be asked in a different community and ill repost it.
    I have just changed my website host and have repointed my DNS to new host. However my macbook pro keeps taking me to the old host.
    I have tried other computers and they all seem to go to new host , so it appears my mac is the problem.
    I have tried clearing cache , history and cookies in the hope it would fix the problem but it hasnt.
    What am i overlooking??????
    Im not IT smart so please reply in simple language .
    Any advice appreciated.
    thanks
    CG

    If you moved your domain from one hosting service to a different one, and changed the the nameservers listing for your domain - which is what I think you're saying - then the "problem" really lies outside of your MacBook.
    Changes to DNS entries, like the nameservers, can take anywhere from minutes to as long as a couple of days to propagate through the DNS system. How fast that change will show up for your ISP depends on how often their DNS servers update their caches and how often the hosting service updates their DNS entires to the DNS servers they are linked to. (Typically, hosting services are linked to DNS servers that update rather frequently - no less than once an hour.)  The other computers you used may be hooked to different DNS servers that get updated more frequently than the one your MacBook is using.
    If you know the IP address of the new hosting site, you can plug that into the address bar of your browser and it should get you to the new host, no problem. Using a URL is going to rely on updated DNS information making through the DNS system.
    HTH,
    -Doug

  • Problems with Graphics and a Timer...

    Alright so what I'm trying to do is when my character attacks (after the user pushes the ctrl button) I want the attack sprite to show, along with a simple slash graphic, then after less than a second I want the graphic gone and the sprite to return to standing mode. the problem is that it doesn't return, it just stays with the graphic and the attack sprite until the user moves.
    here's the attack sub
            public void attack(){
                    at=true;
                    udchar(3,"attack1");
              sleep(300);
              repaint();
            }here's my sleep sub
            public void sleep(long l){
                    try{
                            Thread.sleep(l);
                    catch(InterruptedException e){
                            return;
            }and here's my paint sub
            public void paint(Graphics g){
                    bufferGraphics.drawImage(background,0,0,10000,600,this);
                    bufferGraphics.drawImage(sidebar,720,0,200,600,this);
                    bufferGraphics.drawImage(chara,px,py,128,128,this);
                    bufferGraphics.drawImage(sworda,px,py,128,128,this);
                    bufferGraphics.drawImage(hi,6,507,96,96,this);
                    bufferGraphics.drawImage(li,200,507,96,96,this);
                    bufferGraphics.drawImage(mi,394,507,96,96,this);
                    if(at==true){
                            if(dir.equals("right"))
                                    bufferGraphics.drawImage(slice,px+100,py+20,128,128,this);
                            else
                                    bufferGraphics.drawImage(slice,px-100,py+20,128,128,this);
                            at=false;
                    g.drawImage(offscreen,0,0,this);
            }Help would be much appreciated. I'm not sure if I need to include any other parts of my code or not. If I do just let me know and I'll post that part of the code when I get home from work. Thanks in advance.

    There are a variety of Graphics forums that can provide the specialized help you need though, such as Java2d and Java3d, about 1/3 of the way down the forum list.

  • I Start a New am so frustrated with problems syncing photos on my iPad. I choose which files to sync but get deleted photos in my albums, my photos are in the wrong albums and the weirdest of all- I now have strange graphics and Facebook photos in albums!

    I have spent several hours trying to find a solution to the following problems. After syncing my IPad with ITunes, I end up with photos that I previously deleted in my albums, duplicate photos, albums that have wrong pictures in them and weirdest of all, strange graphics and Facebook photos that are not even mine. Right now I hate this thing!
    I have scanned the support forums, Googled it, deleted several photo caches, spent days editing my photo files, checked the specific folders I wanted to sync and it seems like it's not syncing, just adding the same photos and strange crap that it already had on it. Oh please help me!
    Thanks!

    OK....I'm stumped.  The message you are seeing is typically there to protect someone from syncing with a different computer/iTunes account.  Is there any way anyone else has used your iPad and possibly connected it to their computer?

  • Windows 7 64-bit: Switchable graphics and Ricoh card reader problem

    Hi guys,
    Two problems with my laptop. I'm using a T400, previously installed with Windows Vista Business 32-bit.
    Switchable graphics worked well until I formatted and installed Windows 7 Pro 64-bit (I got the RTM through MSDNAA). Now, Windows can only detect either the discrete graphics or integrated graphics at one time. When the BIOS was set to switchable graphics and enabling the detection of switchable graphics on Windows, it could only detect the Intel integrated graphics. When I try to switch to High Performance graphics through the Lenovo power manager, the screen flashes once, and the ATi graphics card appears on the device manager with the code 10 error (cannot start device). Also, compared to this image, my power manager window that opens with left-click does not have battery stretch and switchable graphics options. I have to right-click to switch my graphics.
    After some tinkering, I managed to activate the graphics card through the BIOS by switching it to discrete graphics only and disabling switchable graphics detection by Windows. Now the device manager shows the ATi card only, the Intel integrated graphics is gone. I understand that it should show both display adapters in the device driver when the ATi card is active: http://www-307.ibm.com/pc/support/site.wss/MIGR-70495.html#g4
    The second problem is with the Ricoh card reader. I managed to install the drivers properly, but the device shows up with a code 12 error (This device cannot find enough free resources that it can use) in the device manager. That error appears on 6 items in the device manager:
    Ricoh Memory Stick controller
    Ricoh SD/MMC Host controller
    Ricoh xD-Picture card controller
    Ricoh 1394 OHCI Compliant host controller
    Ricoh R/RL/5C476(II) or Compatible CardBus controller
    SDA Standard Compliant SD host controller
    Additionally, 6 error messages appear during every boot up, which I think is related to these 6 devices:
    ERROR
    Resource Conflict - PCI in slot 07
    Bus:15, Device:00, Function: 00 (it ranges from function 00  to 05)
    AND disabling the device through device manager results in a BSOD.
    I've seen some people post about the Ricoh problem, but didn't have any resolution (at least for those who had the boot up error message too). The switchable graphics problem seems quite common too but in my case it seems like it is working fine EXCEPT for the fact that only one graphics adapter can appear on the device manager at one time and I can't do switching at all. Anyone know if I can somehow solve this? Sorry for the wall of text and two-problems-in-one. I put them together because I don't know if one problem is affecting the other as both problems appeared at around the same time.

    As far as the graphics goes it's well accpeted the only way at present to switch is though the bios manually. There is currently no drivers that enable users to switch from within Win7. Know it's a pain but will just have to wait.

  • Video Or Graphic Card Driver Problem After Clean And Re-Install Windows 7 32-bit

    Video Or Graphic Card Driver Problem After Clean And Re-Install Windows 7 32-bit I m Tired I m Finding & Finding Drivers
    But I Wont be Able To Play Games & Other Apps  Please Solve This And Give Me Link For Video Card Driver Or
    Graphic Card Driver For Windows 7 32-bit (x86)
    THANKS
    PROFESSOR TOM........................................

    Hi:
    See if this W7 32 bit graphics driver works...
    http://h10025.www1.hp.com/ewfrf/wc/softwareDownloa​dIndex?softwareitem=ob-100029-2&cc=us&dlc=en&lc=en​...

  • EPDF files failing to read on ADE reading software when they have Sidebar color graphics and text, how do we fix problem?

    We have 2 different InDesign files not reading properly in ADE reader. Both files have sidebar color graphics and text in them. The one original file's EPDF was showing blank pages for all the page with the sidebars in it when opened in ADE (they are DRM wrapped). Pages that did not have the sidebar showed up fine. Our ebook distributor is telling us that we have to rasterize the file. We are working in InDesign 6 with Adobe Acrobat X Pro. We made JPEGS of each page and reimported into an InDesign file and exported to PDF and our ADE reader then showed the sidebar pages. The file is pretty large though and I have a full length book that has the same problem. What is the problem with our sidebars and what are better solutions than JPEGS for each page? Thanks.

    I will give that a try, thank you.

  • I still have a problem clearing history and i did select time range to Everything

    I still have a problem clearing history and i did select time range to "Everything". I tested using Internet explorer and I could clear the history there so its not a problem with the Xp secondary account. I even disabled the add ons in firefox and still get the same issue

    sorry, scratch this, the first post did enable me to find a solution, it was the signon.sqlite file that had become corrupted.
    As an interesting aside, this has also fixed the problem with using Xmarksspace which was giving me an "error 3" synchronising problem.
    Apologies for the tone of my previous posting, you did provide the information that enabled me to find a solution, thank you and sorry.
    Regards
    Crashhot

  • When I turn on a video the screen on my MacBook Pro freezes.  I've been through Apple Care and they couldn't fix the computer.  I think the fan and the graphics are the problems

    When I turn on a video the screen on my MacBook Pro freezes.  I've been through Apple Care and they couldn't fix the computer.  I think the fan and the graphics are the problems.  I can restart after two attempts.  Sometimes I use SAFEBOOT

    Please advise the model MBP you have and the OSX you have installed.
    Also try a SMC reset:
    http://support.apple.com/kb/ht3964
    Ciao.

  • Bbc homepage not loading, even though I cleared cookis and cache. Any advice on how to sort this problem?

    I have FF version 4. The BBC home page will no longer load, though I can load other BBC pages such as BBC news. I don't know why it won't load and I just get a blank white page - t loads in safari fine. I have cleared cookies and cache but it makes no difference. Please advise on next steps for trying to sort.
    thanks

    Are of your purchases done under a single Apple ID/iTunes Account?  Perhaps this article can provide a resolution.
    iTunes repeatedly prompts to authorize computer to play iTunes Store purchases
    B-rock

  • After upgrading to Lion 10.7.1 - iPhoto and other programs slow to open and other problems

    Am I alone - having lots of problems with 10.7.1.  iPhoto is slow and when I export photos it exists iphoto then I restart and sometimes it will works.  Safari is slower also. Sometimes it justs hangs and I have to force quit.  iTunes is also slower to open. Almost everytime it goes to a checking library for a long time. 
    Should I go back to previous version? Will I lose my purchase. I do not have disks for the upgrade.  I do not want to go back - I have a lot of data and always fear of losing it. 
    Think Apple knows about the problems or am I the only one and have some other problem?

    olegz,
    First, thanks for the clear graphics.
    Authorization seems to be the hangup here. But instead of dealing with the complications of conflicts in authorization, which might take several weeks to months to iron out - site by site - I urge you to follow a different path.
    It looks like you're using Chrome. For this site alone, use either Safari or Firefox, both of which are more likely to have plugins to deal with authorizing your site. Safari is already on your computer, but v.3 of Firefox is stable, too. Frankly, I can't tell you what specifically might be the problem here; but switching browsers will solve the immediate problem.
    Sound good? Not so good? Post in this thread so that I or others can solve your problem once and for all!

  • New Motherboard and Processor PROBLEM!!!

    Howdy...
    I just brought new Motherboard 865PE Neo3 , new Celeron D Processor and 1 GB PC3200 RAM Memory...Well i installed everything but the problem is all that i can get now is just a blank screen....I tried everything ...clearing bios and everything that i could find on this forum but still nothing....
    Computer is working fine ......i can turn computer on ..and i can hear my HD ..doing something...but screen ..nothing...
    I tired all of my graphic cards ...PCI...and AGP ..and still nothing....i cant even hear beep from my PC Speaker...Help me if u can...because ...i will return all this stuff tomorrow if i dont fix it now....
    THANX...

    dont see a video card,operating system,hard drive,optical drive,floppy drive,case.
    if you can create links,you can create a sig and list the pieces that make up a system!
    people here can help,make it easy for them to help and see what happens or they will just ignor your post.
    Quote from: Dr_Phil on 05-April-05, 01:45:42
    Howdy...
    Ok...here is all the that i have brought.....
    - Motherboard -
    - Processor -
    - RAM Memory -
    - Power Supply -
    Thank You...

  • ICal syncing with mac and iphone problem - duplicating all alarms.

    I have a mobile me account linked to my office mac, my home mac and my iPhone and my wife's iphone. I have been using this to sync all my contacts and calendar for 18 months with no problems until just after christmas. It suddenly duplicated all my contacts and all my iCal alarms. To solve it I had to use time machine to take my ical and address book back a few days and then force everything to update from that machine.
    This I thought solved it but now three weeks later it has duplicated all my alarms again. Why is this happening and how do I stop it? It does not inspire confidence in this system if it randomly changes things. How do I know it will not suddenly delete something? It is also very frustrating and time consuming to reset all the data back a few days.
    Any help or advice would be appreciated.

    The synchronization between iCal, MobileMe, and iPhone is one of the biggest embarrassments and disgraces Apple has yet to deal with.
    For over a year, I have been battling duplicates with little success. Add to all this MS Entourage, which I had to install last year because Mac Mail doesn't play nicely with Exchange server. (My company uses Exchange for our mail, etc.) To be clear, the duplicate problem existed prior to the addition of Entourage 2008. So you are out of luck, Koolaide Fans; you can't point the finger at MS in this case.
    After 6 months of struggling and fighting with Entourage (and because there is no native version of MS Project or Visio for Mac) I finally had to install VM Ware with Windows 7, MS Office 2007, Visio, Project, etc. The MS apps work perfectly under the Windows 7 session. So, I my functionality for business has been restored. However, I am left wondering why I have a Mac if it can't provide me the functionality I need for such basic things as Email, calendars, contacts, and tasks. I am to the point where I am basically doing everything in the VMWare session under Windows.
    I am very pleased with my Mac's ability to do video editing, graphics, and sound using Adobe products. But again, I work in mainstream corporate America where 90% of the marketshare is still PC/Windows.
    In the end, I am hoping someone from Apple can come forward soon and say "This is EXACTLY how you need to configure your Entourage/iCal/MobileMe/iPhone so that you aren't crippled by duplicates and other nonsense...." It really is ridiculous.

  • Graphics and Warranty

    Okay, so at this point I am not in any kind of rush to get my MacBook, but I do have some questions in regards to it.
    1) I have heard mixed sayings about the new Integrated Graphics.
    I will using GIMP and maybe Photoshop one day when I can afford it and it is universal binary). I was told that it will run terrible, but I was also told it will run fine. I am guessing it will run fine. -- I will at the most do LIGHT video editing of personal minute long clips and what not, but nothing pro, so I'm sure it will do fine. I am not a gamer but if it could run a light game or two that would be great. The side I'm leaning on is that the 950 Intel Graphics are fine, but people are just talking smack ignorantly because of previous bad integrated graphics, and that it will do fine.
    2) The AppleCare Warranty.
    Should I buy an extended warranty (if I get it through Amazon it is 200 bucks for 3 years AppleCare)? Or will I be better off not getting it. Part of me wants to protect my investment, part of me says I wont have any major problems with it anyway. and if I do buy it, I was told that adding ram to my MacBook can possibly void my AppleCare Warranty, and Apple may refuse to fix my MacBook if something does go wrong. -- I did read that my AppleCare is not violated if I leave one of the 256meg Apple Branded memory sticks in and just ADD a stick to it, is this true? I was going to add a 1 GB stick to it, meaning I would have 1256ish megs of ram... which leads to the other question, will uneven ram sticks have a bad/noticeable effect on my performance?
    Thanks in advanced,
    APLARDI

    Upgrading your RAM won't, unless you clearly damaged your MacBook during the process, void your warranty.
    As for possible performance drops due to an unmatched pair, personally I would doubt any real noticable performance loss under normal user conditions. If you will use your MacBook in such a way that would require the maximum possible memory throughput then upgrade in matching pairs. There are few instances where the difference between a 10GBps throughput of a matched pair is noticable different to a 5GBps throughput.

  • LG Ally text message and gps problems

    hello. ive been with verizon for about 10 years maybe. ive been overall happy with the service and customer service. but the prices should be alot lower.lol. i started out with the motorolas then switched to the lg phones. only problem with the motorola was the speakers. not loud enough. could never hear the phone ring. the lgs usually suffer from the same problem.
    i had a few phone problems but nothing like this lg ally. im on my second one and about to be my 3rd one in about 3 months. 1st phone i had every problem under the sun. this phone i am suffering from text message problems and gps problems. i suffer from what everyone else has problems with. the messages wont send. they will eventually lock up. it will show the envelope with the red explanation point ( i think thats the graphic). then usually everytime when i sent a text the texts will close. it will send then bounce back and show up as a draft and i have to resend it and wait for it to go thru. finally the last problem with the texts. when i send a text a phone number from my contacts shows up and freezes on the screen. its in white text with a black background. its the same number every time. it stays on the screen until i restart or pull my battery out.
    gps. when i open up google gps that comes with the phone i make sure the gps is on... when the directions are found and the map pops up 9 out of 10 times it just keeps saying searching for gps. the turn by turn never is found. the 1 time it does it takes a good 10 minutes to be found. atleast on my first one ally the gps did work 8 out of 10 times. it just took a good 5-10 minutes for gps to be found and show turn by turn.
    anyone else have these problems? where you able to fix them or did you need to get a new phone? the 2.1 update was supposed to fix problems. i think they just made it worse. the ally is supposed to have 2.2 froyo. where is it. is it ever going to get it. i got this phone because i like the lgs and the keyboard. also the sales representative on the phone was giving the lg ally rave reviews. why couldnt he say dont buy this go with a motorola droid. this phone is the biggest junk ever made

    I do apologize you are having trouble with your device I looked in our information system on the LG Ally in reguards to issues you are having it states if you have the Free Droid Security anti virus protection application down loaded it will cause the phone to lock up or freeze. Check and make sure you do not have the application on your device. Check you GPS settings and make sure correct. Go to Settings; Location & Security; make sure GPS is on wireless network. If this does not fix issue you can try doing a Master Reset on your device. Make sure your contacts are saved in your G-mail account or through Back Up Assistance.
    Master Reset/Soft Reset:
    Factory Reset option 1
    From the main screen, touch menu tab
    Touch Settings
    Touch Privacy
    Touch Factory Data reset
    Touch Reset Phone
    Warning: This will erase all data from your phone, including:
    Your Google account
    System and application data and settings
    Downloaded Applications
    It will not erase: Current System software and bundled applications; SD Card files, such as music or Photos
    Factory Reset option 2  - Warning this will reset device back to original factory settings.
    Turn off the phone
    Press and hold "home" + "end" + "volume up or down" keys together for a few seconds when the device is power off
    Once device displays boot information, release keys.
    Soft Reset
    Press the Power key.
    Touch Power off.
    Touch OK.
    Press the Power key to power on the device.
    or
    Remove battery cover, remove battery and reinstall.Also there is a new update for LG Ally it will be the Froyo 2.2 but there is not release date available at this time it will post on your device when available. Hope this Helps. Leslie

Maybe you are looking for