On 8/27/16, 9:50 AM, "CodeGirl" <[email protected]> wrote:

>Alex, we already know more often than not, your the one who is going to
>answer.
>
>I was not having a problem in this question, I was asking your opinion.
>
>I can tell when you are very busy because our questions have to be much
>more
>detailed when your more busy and I think you must be very busy right now.
> 

Well, it is true that sometimes I am busier than normal, but sometimes I
am not supposed to be working like on weekends or company holidays and
vacations.  Keen observers will be able to guess what the situation is by
my email patterns.

But it is also true that some questions can have different answers based
on certain factors.  If I have time and feel like many others could
benefit, I might take the time to create a long answer, but other times I
am going to try get more details to answer more specifically.

For this topic, the answer can depend on whether you are loading an image
multiple times, what the raw image data looks like, etc.  In your recent
posts we've seen mention of Base64-encoded bitmaps, embedded images, and
loading PNG and JPGs.  The answer really does depends on those factors.
>
>So, I am combining a question now with also asking your opinion.
>
>I am loading a jpg image which is a texture I will use to map onto a 3D
>image.  And here is my code which I am loading two different images for a
>barn.   I am asking your opinion if you think this is a good way to load
>multiple images.  Also, I got this code from an example.  As you can see,
>the code uses a URLLoader to load the binary data and then the Loader is
>converting that Binary data into an image.  My original question in a
>previous message was "Is the URLLoader really needed here?"  I am guessing
>the person who gave the example used the URLLoader and then the Loader
>because they are doing this over the web which also works on a local
>machine.  I am guessing the Loader would not work over the web.  So I am
>asking someone who knows this stuff really well your opinion on best
>practices.

flash.display.Loader was originally designed to load .JPG, .GIF, .PNG, and
.SWF files over the web.  Then it got a loadBytes method that allowed you
to pass in the raw data in case you already had a copy of the data.

The simplest way to load multiple .JPGs that live at different URLs is to
just use flash.display.Loader.

The code below is using URLLoader to load data.  The most common reason
for doing this is to build up an in-memory cache of bitmaps for when you
want to make a particular bitmap appear on the screen more than once.  If
you just use flash.display.Loader, the browser should cache the image, but
the second (and Nth) copy is still being pulled from the browser cache.
However, as with all in-memory caches, you have to worry about running out
of memory and stale items in the cache.  URLLoader would also be best for
Base64-encoded images, since Loader doesn't understand them.

I've never spent any time with the 3D part of Flash.  If you need pass in
a flash.display.Bitmap (or BitmapData) that will be replicated many times,
then you first have to understand the source of the image.  If you have
Base64-encoded bitmaps, you would load them with URLLoader, Base64-decode
them and then you have your bitmap.  If you have .JPGs from the web, I
think I would still use a Loader to convert the .JPG into a Bitmap,
otherwise if you use URLLoader you'd have to decode the image by hand or
still use a Loader and loadBytes.  Unless you need an in-memory cache.

>
>Also, a little about me, I live in a Horse Trailer.  I am poor and I do
>not
>work for anyone.  My horse trailer is parked in a farmers field out in the
>country.  So I do not have people to talk to.  I code to pass time.  Also,
>sometimes, I cant afford my cell phone which is how I access the Internet
>and during those times, I have no way to look up information.  So when I
>get
>cell phone service, I have questions.  I try to google first but if I am
>not
>finding answers then I ask.  When it comes to Flex and Actionscript, your
>the guy I ask.

That's an interesting life story.  FWIW, assuming the farmer knows you are
in his field, and you are friendly with him, if he has a better internet
connection, I saw a suggestion the other day that it might be cheaper to
buy him a bottle of wine once or twice a year in exchange for plugging
into his internet hookup instead of paying for a cell phone data plan.
And if you are looking for more software development work and have some
spare cycles, you could gamble and become proficient with FlexJS by
helping us fix bugs and add features.  If FlexJS gets some traction, the
committers who are better experienced with FlexJS should be able to get
some good gigs helping everyone else learn.

Thanks,
-Alex

Reply via email to