Dec 08
PrintJob has been giving me a couple of problems lately, one of them was proper placement of the objects on page. This post discusses the fix
NOTE: I have not been able to confirm the behavior described here, may be it was just something i was doing wrong. However i am posting it here so that if it’s really a problem, this fix might help
Say, there’s a Sprite/MovieClip of a standard page size (say A4), say it’s called ‘p’, naturally you would print it as:
var pj:PrintJob = new PrintJob();
if(pj.start())
{
pj.addPage(p); // p is the Sprite/MovieClip of full page size
pj.send();
}
Say you had an rectangle (the only object in the Sprite) right in the middle of the sprite, since the sprite’s size equals the page size, you’ll expect the rectangle to be printed in the middle of the page, right? Surprise! it gets printed in the top left corner.
What happened here is that actionscript aligned the first drawn pixel (the top left corner of the rectangle) to the top left corner of the page. To workaround, you may draw an invisible rectangle of the full page size to the Sprite so that everything gets printed neatly. here’s what you would do:
var pj:
PrintJob =
new PrintJob();
if(pj.
start())
{
p.
graphics.
lineStyle(1, 0xFFFFFF,
0);
p.
graphics.
drawRect(0,
0, PageWidth, PageHeight
);
pj.addPage(p); // p is the Sprite/MovieClip of full page size
pj.send();
}
written by ishaq
Dec 08
I just finished Who Moved My Cheese by Dr. Spencer Johnson (I hope I spelled that right
) after it had been lying around for about 6 months. It’s a great short story, takes about 45 minutes to complete and nicely describes different behaviors when a change is encountered.
I didn’t like the discussion in the later part of the book though, It seems, may I say, too artificial.
And btw, while I am not Sniff or Scurry, I do try to be Haw. (if you don’t understand what I mean, go read the book
)
Technorati Tags: change management, spencer johnson, who moved my cheez
written by ishaq
Dec 06
I am working on an ActionScript 3.0 module in my day job, and although I am new to ActionScript, I rarely touch the documentation (yeah yeah, I know I should do it more often =) ), most of the time it works, may be because I was on Java before.
Last day, I needed to find out the stage’s height somewhere, so I just typed
stage.h
and thanks to intelli-sense, it quickly told me that it was
stage.height
i was looking for. But something strange happened and i was not getting the value i expected. After a couple of hours of hair pulling, it dawned on me that I should be using
stage.stageHeight
instead of
stage.height
to get stage’s height.
I can’t say whether Adobe/Macromedia’s decision to use
stage.stageHeight
and
stage.stageWidth
instead of
stage.height
and
stage.width
was right, but the property name is not abundantly clear in what it is going to return.
Technorati Tags: actionscript 3.0, stage.height, stage.width
written by ishaq
Dec 03
http://sean.cruels.net/directx has some video Tutorials on DirectX, they are pretty basic though (as is the case with most of the video tutorials) and may only help beginners to get started. Also, since they tutorials are made by some guy in his free time (in my opinion), do not expect the quality to be top of the notch.
and by the way, the above site (http://sean.crules.net) has some tutorials on other topics such as Java and SQL as well. I only checked SQL tutorials and they are very good especially for students who are using Oracle in their DB course labs.
Technorati Tags: directx, video tutorials
written by ishaq