Re: [Flashcoders] Reusing an Image

2011-03-29 Thread Kevin Holleran
On Tue, Mar 29, 2011 at 10:23 AM, Merrill, Jason 
jason.merr...@bankofamerica.com wrote:

 I would agree with Henrik. Using the Vector class would be better in this
 case (or if Vector is confusing even just Array - Vector is just a typed
 array where you declare the data type and enforce it).  And doesn't seem to
 me you need to separate hour digits from minunte digits - you're just
 dealing with numbers 0-9. Here is an example.

 Instead of this: hours_digit1[1] = new Bitmap(number_1_image);
 hours_digit2[1] = new Bitmap(number_1_image); hours_digit3[1] = new
 Bitmap(number_1_image); min_digit1[1]  = new Bitmap(number_1_image);

 Do this:

 var digitBitmaps:Vector.Bitmap = new Vector.Bitmap();

 for (var i:int = 0; i9; i++)
 {
digitBitmaps.push(new Bitmap(number_+i+_image));
 }

 Then, to get the image you want do the following. Say you wanted to get the
 number 7:

 var image7:Bitmap = digitBitmaps[7];



  Jason Merrill
  Instructional Technology Architect
  Bank of America  Global Learning





 ___

 -Original Message-
 From: flashcoders-boun...@chattyfig.figleaf.com [mailto:
 flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Kevin Holleran
 Sent: Monday, March 28, 2011 9:05 PM
 To: Flash Coders List
 Subject: Re: [Flashcoders] Reusing an Image

 On Mon, Mar 28, 2011 at 1:11 PM, Henrik Andersson he...@henke37.cjb.net
 wrote:

  You might want to have a look at the Bitmap.bitmapData property.
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 


 Ok, so forgive me as I have never used this before and am new to AS.  I
 want to load a series of 10 images, these will be numbers in a countdown.
  Its possible for an image to be used 7 times at once (111:11:11).  If I
 want to use the same image would I load the image into BitmapData, the turn
 around and have a series of Bitmap objects for every digit?

 clock_image_loader.addEventListener(Event.COMPLETE, images_loaded);

 private function images_loaded(event:Event): void {
  number_1_image = Bitmap(LoaderInfo(event.target).content).bitmapData;
  }

 then do something like this?

 hours_digit1[1] = new Bitmap(number_1_image); hours_digit2[1] = new
 Bitmap(number_1_image); hours_digit3[1] = new Bitmap(number_1_image);
 min_digit1[1]  = new Bitmap(number_1_image);

 and so on?  this would mean I would need a declaration for all seven digits
 for 0-9.
 (This is tossed together but I think you get the idea.)

 Again, I am new to this and I would think there would be a better way to
 get what I need that is more efficient

 Thanks for your help as always

 Kevin
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 --
 This message w/attachments (message) is intended solely for the use of the
 intended recipient(s) and may contain information that is privileged,
 confidential or proprietary. If you are not an intended recipient, please
 notify the sender, and then please delete and destroy all copies and
 attachments, and be advised that any review or dissemination of, or the
 taking of any action in reliance on, the information contained in or
 attached to this message is prohibited.
 Unless specifically indicated, this message is not an offer to sell or a
 solicitation of any investment products or other financial product or
 service, an official confirmation of any transaction, or an official
 statement of Sender. Subject to applicable law, Sender may intercept,
 monitor, review and retain e-communications (EC) traveling through its
 networks/systems and may produce any such EC to regulators, law enforcement,
 in litigation and as required by law.
 The laws of the country of each sender/recipient may impact the handling of
 EC, and EC may be archived, supervised and produced in countries other than
 the country in which you are located. This message cannot be guaranteed to
 be secure or free of errors or viruses.

 References to Sender are references to any subsidiary of Bank of America
 Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are
 Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a
 Condition to Any Banking Service or Activity * Are Not Insured by Any
 Federal Government Agency. Attachments that are part of this EC may have
 additional important disclosures and disclaimers, which you should read.
 This message is subject to terms available at the following link:
 http://www.bankofamerica.com/emaildisclaimer. By messaging with Sender you
 consent to the foregoing.
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




Thanks

[Flashcoders] Reusing an Image

2011-03-28 Thread Kevin Holleran
Hi,

I am loading some images into an array of loaders.  Is there a way to bind
these to a class or something to reuse?  So the image at images_loader[0]
may be used three times.

Thanks for your help.

Kevin
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Reusing an Image

2011-03-28 Thread Kevin Holleran
On Mon, Mar 28, 2011 at 1:11 PM, Henrik Andersson he...@henke37.cjb.netwrote:

 You might want to have a look at the Bitmap.bitmapData property.
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



Ok, so forgive me as I have never used this before and am new to AS.  I want
to load a series of 10 images, these will be numbers in a countdown.  Its
possible for an image to be used 7 times at once (111:11:11).  If I want to
use the same image would I load the image into BitmapData, the turn around
and have a series of Bitmap objects for every digit?

clock_image_loader.addEventListener(Event.COMPLETE, images_loaded);

private function images_loaded(event:Event): void {
  number_1_image = Bitmap(LoaderInfo(event.target).content).bitmapData;
 }

then do something like this?

hours_digit1[1] = new Bitmap(number_1_image);
hours_digit2[1] = new Bitmap(number_1_image);
hours_digit3[1] = new Bitmap(number_1_image);
min_digit1[1]  = new Bitmap(number_1_image);

and so on?  this would mean I would need a declaration for all seven digits
for 0-9.
(This is tossed together but I think you get the idea.)

Again, I am new to this and I would think there would be a better way to get
what I need that is more efficient

Thanks for your help as always

Kevin
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Getting Data into my SWF

2011-03-15 Thread Kevin Holleran
On Mon, Mar 14, 2011 at 5:31 PM, Henrik Andersson he...@henke37.cjb.netwrote:

 Jordan L. Chilcott - Interactivity Unlimited skriver:

  Unless the client is actually displaying a countdown, it has no need for
 the data. All the client needs in this case is a polling mechanism to occur
 on a set interval, whether or not it intends to display any countdown down.
 No data needs to be pass back to the server. All the client is essentially
 asking is coupon?. Server either gives a coupon or something else that is
 of no use for anyone to manipulate.

 jord


 To elaborate on that idea:

 Client asks the server and the server either sends the coupon or the time
 left. The client then acts differently depending on the received data. This
 way there is only one request made in either case.

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



I like that!  Good call, much more efficient.  The countdown is displayed so
that date is important.  I like the single call that way.

Thanks again.

Kevin
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Getting Data into my SWF

2011-03-14 Thread Kevin Holleran
Thanks to everyone for all of your responses.

What is going to happen, is the application is going to hold a coupon.  That
coupon will be retrieved from a database and passed into the Flash
application.  I guess as I am writing this, the script will just check the
date and if it is not correct, it can simply not return the coupon.  My
question revolved around a user manipulating the date passed into the flash
application and causing the coupon to show up before the countdown is really
up.

Thanks very much.
Kevin


On Mon, Mar 14, 2011 at 2:59 PM, John McCormack j...@easypeasy.co.ukwrote:

 If the server script knows the acceptable date from the database, it can
 just ignore early requests.

 Is the problem that Kevin doesn't want the client swf to hold the date for
 fear of it being known?

 If so, a key could be sent instead that relates to the download date and
 stored in the database. Each time the swf runs it sends the key and the
 server checks that against the date.

 John


 On 14/03/2011 12:19, Developer wrote:

 No, I get it. The client and data transfer are insecure.

 The hidden information (or the trigger to show the information) should
 come from the server not from the client.

 Don


 On 3/14/2011 3:54 AM, Henrik Andersson wrote:

 Developer skriver:

 Wouldn't it also be helpful to have the server-side script verify
 (validate) the data the swf is sending back up?
 That way if someone manually triggered the date, the server would not
 accept it because it doesn't match it's system date.

 Don.



 You have a point. The server can reject anything that the client sends.

 But at the same time you also fail to get it. The client doesn't have to
 care for what the server does. So what if the server doesn't like the date?
 The client has no obligation to care about that.

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Getting Data into my SWF

2011-03-14 Thread Kevin Holleran
@Jord - The date will be passed in or retrieved from a script and would be
the server date.  My concern was that the date would be intercepted/modified
in some fashion, but since the end result is retrieved from the server, the
server script will just have a check to make sure the date is right to
release it.

Thanks for all the ideas from everyone, I enjoyed the discussions.  I'm sure
I'll be asking more questions as I move through this project.

Kevin


On Mon, Mar 14, 2011 at 3:17 PM, Jordan L. Chilcott - Interactivity
Unlimited jchilc...@interactivityunlimited.com wrote:

 Why would you be relying solely on a user's clock? That is most easily
 manipulated simply by changing the date and time in their system
 preferences.

 No hacking experience required.

 jord
 --
 Jordan L. Chilcott

 Sent from my iPhone... because I can

 On 2011-03-14, at 3:06 PM, Kevin Holleran kdaw...@gmail.com wrote:

  What is going to happen, is the application is going to hold a coupon.
  That
  coupon will be retrieved from a database and passed into the Flash
  application.  I guess as I am writing this, the script will just check
 the
  date and if it is not correct, it can simply not return the coupon.  My
  question revolved around a user manipulating the date passed into the
 flash
  application and causing the coupon to show up before the countdown is
 really
  up.
 

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Getting Data into my SWF

2011-03-14 Thread Kevin Holleran
On Mon, Mar 14, 2011 at 3:57 PM, Jordan L. Chilcott - Interactivity
Unlimited jchilc...@interactivityunlimited.com wrote:

 If I'm getting this straight:

 You're asking for a date from the server which you're going to pass back
 for approval to show a coupon on the client side app.

 Why not just have the server store and send the coupon for the application
 to use? The client simply makes one call (two at most... but it can be
 handled in one call, letting the server do all the work - the client is a
 simple willing participant). No other data is passed back for the client to
 manipulate.

 jord
 --
 Jordan L. Chilcott

 Sent from my iPhone... because I can

 On 2011-03-14, at 3:40 PM, Kevin Holleran kdaw...@gmail.com wrote:

  @Jord - The date will be passed in or retrieved from a script and would
 be
  the server date.  My concern was that the date would be
 intercepted/modified
  in some fashion, but since the end result is retrieved from the server,
 the
  server script will just have a check to make sure the date is right to
  release it.
 

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




The engine is a countdown from the current date/time to the date/time when
the coupon becomes visible.  So the date is used for the counter and then
once the counter reaches zero, the coupon is retrieved from the server and
displayed.

Kevin
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Getting Data into my SWF

2011-03-10 Thread Kevin Holleran
Hello,

I am very new to implementing Flash and ActionScript so forgive me if I am
way off base.

I have an application that utilizes the date and time.  It is imperative
that this is correct and not from the client's machine.  To get the server
date/time, I can pass it in as a FlashVars or I can call a PHP script from
within Flash and load the date as returned data from the call.  Is there
another way?  Is one way more secure than another?  I have read FlashVars is
not safe but it always referenced passing passwords in.  I am not
concerned with the user SEEING the data, I just don't want them to be able
to load the SWF in a way that they would be able to pass in their own
values.

Also, in a similiar fashion, I want to load some data from a database.  I am
using a MySQL backend and figure to use a PHP script to do the data
manipulation I need then call the data from within my ActionScript.
 (Essentially, I am going to be loading some images from the database based
on criteria, then I want to be able to use those in my flash application).

Thanks for your patience and help.

Kevin
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Getting Data into my SWF

2011-03-10 Thread Kevin Holleran
I'll explain further so I get valuable responses and avoid the sarcasm.  My
goal is to pass in the date from the server, the application counts down,
and when the date hits a certain time, the application does something.  This
something that the application does will also be loaded by calling a PHP
script that will load from a backend DB.  My concern is someone being able
to launch the SWF passing in an incorrect date that will trigger this
something early.

Thanks for your help.

Kevin
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Printing Canvas

2009-10-23 Thread Kevin Holleran
I am trying to use AlivePDF to simply export the entire contents of
the canvas to a PDF.  All the examples I am finding include using the
API to draw a PDF, I just want to take what I already have on my
canvas and send that to a PDF.  Does anyone know a way to do this with
AlivePDF?

Thank you.

Kevin
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Printing Canvas

2009-10-23 Thread Kevin Holleran
How can a copy the display object into another so that I can
manipulate the coped object but not the original?  I want to copy the
object, not the reference.

Thanks.

Kevin
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Printing Canvas

2009-10-23 Thread Kevin Holleran
On Fri, Oct 23, 2009 at 12:48 PM, Kevin Holleran kdaw...@gmail.com wrote:
 How can a copy the display object into another so that I can
 manipulate the coped object but not the original?  I want to copy the
 object, not the reference.

 Thanks.

 Kevin


Okay I have the following code:

public class Coupons extends Sprite {
public var mainMovieClip:MovieClip;
public var printMovieClip:MovieClip = new MovieClip();
var bytes:ByteArray = new ByteArray();

.

public function printCoupons(ev:Event) {
// we set the zoom to 100%
myPDF.setDisplayMode ( Display.REAL );
bytes.writeObject(mainMovieClip);
bytes.position = 0;
printMovieClip = bytes.readObject();
printMovieClip.removeChild(printBtn);
printMovieClip.scaleX = .9;
printMovieClip.scaleY = .9;
// we add a page
myPDF.addPage();
myPDF.addImage(printMovieClip);

When I click the print button, I am receiving an error:

TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at Coupons/printCoupons()

I don't understand what the null object is.  When I remove the
attempted clone of the object, the export to PDF works great, but I
don't want the scale to effect the actual canvas.

Thanks for any help.

Kevin

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Printing Canvas

2009-10-23 Thread Kevin Holleran
On Fri, Oct 23, 2009 at 1:11 PM, Ian Thomas i...@eirias.net wrote:
 Try copying using BitmapData, not ByteArray. Take a visual snapshot,
 not an object snapshot.

 Ian

 On Fri, Oct 23, 2009 at 6:03 PM, Kevin Holleran kdaw...@gmail.com wrote:
 On Fri, Oct 23, 2009 at 12:48 PM, Kevin Holleran kdaw...@gmail.com wrote:
 How can a copy the display object into another so that I can
 manipulate the coped object but not the original?  I want to copy the
 object, not the reference.

 Thanks.

 Kevin


 Okay I have the following code:

        public class Coupons extends Sprite {
                public var mainMovieClip:MovieClip;
                public var printMovieClip:MovieClip = new MovieClip();
                var bytes:ByteArray = new ByteArray();

 .

                public function printCoupons(ev:Event) {
                        // we set the zoom to 100%
                        myPDF.setDisplayMode ( Display.REAL );
                        bytes.writeObject(mainMovieClip);
                        bytes.position = 0;
                        printMovieClip = bytes.readObject();
                        printMovieClip.removeChild(printBtn);
                        printMovieClip.scaleX = .9;
                        printMovieClip.scaleY = .9;
                        // we add a page
                        myPDF.addPage();
                        myPDF.addImage(printMovieClip);

 When I click the print button, I am receiving an error:

 TypeError: Error #1009: Cannot access a property or method of a null
 object reference.
        at Coupons/printCoupons()

 I don't understand what the null object is.  When I remove the
 attempted clone of the object, the export to PDF works great, but I
 don't want the scale to effect the actual canvas.

 Thanks for any help.

 Kevin

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


I ended up scaling it, sending it to PDF, then scaling it back.

Thanks for all your help!

Kevin

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Printing Canvas

2009-10-20 Thread Kevin Holleran
Good afternoon,

I wrote a little flash app that loads coupons from an XML file and
formats them to display on a webpage.  When going to print these, I
simply sent the canvas to the printer.  However, the side of the
coupons are cut off.  Is there a way to shrink what is sent to the
printer (without getting too complex) or a way to export the entire
canvas as a JPG and resize that prior to being sent to the printer?

Thanks for any suggestions.

Kevin
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders