Solved

Help with an old question..... 500 points

Posted on 2004-10-19
4
148 Views
Last Modified: 2010-04-03
Hi,
I would like you experts to try this question i posted a few days back.

Looks like we have reached some solution but not the exact one.

Cerf has been trying hard, I will give additional points through this question to anyone who can solve this:

http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_21169992.html

Cerf, I will consider your help also.

thanks.
0
Comment
Question by:ssdesign
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
4 Comments
 
LVL 10

Accepted Solution

by:
muso120999 earned 20 total points
ID: 12352518
Okay, try this - where p=Loan Amount, n=Loan duration (years), r = Loan rate (%age).  Just stick the code in a new flash (Flash MX) file and run it:

p = 30000;
n = 25;
r = 14 /100;
function createBox(container, clipName, clr, w, h, x, y) {
      var x1 = (x == undefined) ? 0 : x;
      var y1 = (y == undefined) ? 0 : y;
      var x2 = x1+w;
      var y2 = y1+h;
      container.createEmptyMovieClip(clipName, container.getNextHighestDepth());
      container[clipName].beginFill(clr, 50);
      container[clipName].moveTo(x1, x1);
      container[clipName].lineTo(x1, y2);
      container[clipName].lineTo(x2, y2);
      container[clipName].lineTo(x2, y1);
      container[clipName].endFill();
}
// var names as in the website... clearer
var n:Number, p:Number, z:Number, a:Number;
z = r+1;
a = (p*r)/(1-Math.pow(z, -n));
trace("Annual payment: "+Math.ceil(a));
year = new Array();
year[1] = (p*z)-a;
trace("year 1 debt: "+Math.floor(year[1]));
for (var i = 2; i<=n; i++) {
      year[i] = (year[i-1]*z)-a;
      trace("year "+i+" debt: "+Math.floor(year[i]));
}
for (var i = 1; i<=n; i++) {
      createBox(_root, "debt"+i, 0x00ff00, 10, -((year[i]/p)*200));
      createBox(_root, "equity"+i, 0xff0000, 10, 200-((year[i]/p)*200));
      _root["debt"+i]._x = 20*i;
      _root["debt"+i]._y = 200;
      _root["equity"+i]._x = 20*i;
      _root["equity"+i]._y = 200-_root["equity"+i]._height;
}
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12352578
You should notice that it draws a very basic chart too - I had to fiddle using "200-" at the end to convert it to a cartesian coordinate type system (200 is the height of the chart), as the Flash y-coordinates are inverted.

muso
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12373248
Did it work for you  ssdesign?
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12462027
I can only help you properly if you provide some feedback ssdesign!  I'm not bothered about the points at all (I knew it's for 20 points after all ;), but when given a grade B after putting in so much time and effort for your question (I didn't just copy the code from the previous question - all code was written from scratch) is a little dis-heartening!

So whevenever possible I feel it would be nice if you could at least give some feedback on my answer - even if just to say that it isn't quite right for you, for whatever reasons, and that you don't have any more time to spend on it yourself...

muso
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to disable  HTML5 video in chrome 2 1,580
YouTube Link 10 369
anti-download video publishing site? 6 621
how do I install adobe flash player on my ipad Air? 4 55
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question