This content has been marked as final. Show 13 replies
are you waiting until loading is complete before using the bitmap draw method? if so, what makes you think it's not creating a screenshot?
Yes, i have to manually press a button before i call the bitmap draw method and i wait long enough before pressing the button.
Once the bitmap draw method is called, i go through all pixels with:
All values for tmp are then 0, which makes me believe it's not creating a screenshot.
are nwdith and nheight defined?
yes, they are both set to 100 inside the same function
are you sure your swf is loading? does your bitmap exist (use trace(snap) )?
if yes to both, post a link to a zip file that contains the fla with the above code and to your external swf.
here's your corrected code. i'm not sure what you want to send to that php file, but the trace is correct.
do you have the code for the php file? if so, what is it?
Thanks! I was close to giving up, but this really works great.
The code for the php script is:
i changed the code inside the two for-loops in the .fla to:
tmp = snap.getPixel(a, b).toString(16);
that's probably not going to give you want you want. use trace(tmp) to see what you're sending to your php script.
i'm sending hex values such as ffffff (as text), but i forgot to take into account 00ffff becomes ffff. This didn't happen with the first test i did, so i didn't notice that.
I added this line inside the two for-loops in the php script to take care of that:
The images i get out of it look exactly like a section of mr pacman, so i think it's all working.
i hadn't seen the gd library before your post. are you using this on a server? if so, how did you install the compiled gd library to your server?
that really depends on your server's os and other software. i use freebsd with directadmin on my server which automatically installed the gd library.
if you have to install the gd library manually, you have to compile php with --with-gd and possibly with --with-gd-dir=/usr/local and --with-jpeg-dir=/usr/local/lib.