AS3 Load external image and add multiple instances to mcs
Hi,
Is there any way to load an external image and add it to more than one movie clip?
Thanks,
Chris McLaughlin
Hi kglad,
I was loading a larger jpeg to which I was applying 20 different masks so using the bitmapdata class to create duplicates was the best solution.
It took me some time to wrap my head around it, but all is well.
Thanks for pointing me in the right direction.
Best regards,
Chris
Similar Messages
-
Load external images and video in edge
Hi.
I am looking into edge instead of flash.
My question is how do you load external images and videos from an external server?
To clarify, I need to insert a link from where the images can load into the stage, so they don´t take up any of the final weight.
Thanks in advance.
Best,
Stig.The above solution I provided works if you already have the images in your composition and than if you want form load images from another server rather than the relative location to your html file.
Now if you want to load images dynamically into a rectagle containter you will have to code it.
below is a sample for that
Create a 'rectangle' with name 'Rectagle'.
Add the snippet in the compositon ready or on other user actiosn based on your requirement
var myImagetag = '<img src="http://wwwimages.adobe.com/include/style/default/SiteHeader/logo-2x.png">'
sym.$("Rectangle").append(myImagetag); -
Load external image and animate?
This may be a naive question, but -
What is the best method to draw external content (an image
file) into a Flash movie, AND then ANIMATE that content?
I assumed I would need to use the LOADER COMPONENT to draw an
image file from an external URL, but is there a way to then perform
a simple animation (e.g., slide the image across the stage) with
the loaded image? I cannot seem to figure out how to manipulate an
image once loaded (using the LOADER COMPONENT).
Yes, I am new to Flash, so there may be six other ways to do
this of which I am not aware.
Suggestions/solutions?use the MovieClipLoader class to load the image into a holder
movie clip, then use the onLoadInit function to animate the holder
clip. -
Load external image and data in video?
Hi, i'm a newby in After Effects.
I have a question: is it possible to make one like this video?
http://www.facebook-studio.com/gallery/submission/don-natale-1
the first part isn't a problem, but the integration of selected index in the video.... is it possible to make with after effects? And how?
i think that you can load xml file and define areas in video with after effects, but this is my opinion
thankyou.
see youIf you are trying to recreate this video with AE then just import the various videos, scale them and animate their positions. Parent them to still images you're using as the backdrops.
If you asking if AE can export XML data or import XML data to bring video's from another source into AE I have to ask what's the point. AE is a program for making videos. It's not a program for creating interactive presentations. For that you'll need to learn HTML 5 or Flash. AE is not at all designed to produce interactive presentations. It's to create visuals effects... It's not even the right tool to make a movie, but it's a great tool to make a great shot. -
Loading External Images Causes Memory Leak
I have been working on an Actionscript 2.0 project that basically loads external images.
Everytime i load and unload a new image, memory increases to 1 or 2 MBs
If all the images are in cache, then it increased to 4 or 8 KBs
In the unloading of images, I have removed loader and the container of the image.
Any thoughts why it is behaving like that?
Please find the sample code snippet below.
btn_load.onRelease = function()
loadImage();
btn_unLoad.onRelease = function()
unLoadImage();
var mcListener:Object = new Object();
var container1:MovieClip;
var mcLoader:MovieClipLoader;
var loader_reference = this;
var n=0;
function loadImage(){
var image_arr = ["http://xyz.com/image1.png","http://xyz.com/image2.png","http://xyz.com/image3.png","http:/ /xyz.com/image4.png","http://xyz.com/image5.png"];
var image_url = image_arr[n];
if(n==image_arr.length-1) {
n=0;
}else{
n++;
container1 = loader_reference.createEmptyMovieClip("container1", loader_reference.getNextHighestDepth());
mcLoader = new MovieClipLoader();
mcLoader.removeListener(mcListener);
mcLoader.addListener(mcListener);
mcListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
mcListener.onLoadInit = function(target_mc:MovieClip):Void {
target_mc._x = 300;
target_mc._y = 200;
target_mc._width = 300;
target_mc._height = 250;
mcLoader.loadClip(image_url, container1);
function unLoadImage(){
mcLoader.unloadClip(container1);
mcLoader = null;
container1 = null;
removeMovieClip(loader_reference.container1);
Thanks in advance.that code should only execute once. fix that.
-
ADF: want to add multiple instance of .jsff page in af:region dynamically
Hi,
I am having following requirement.
We have one .jsff page, and we want to add multiple instance of this fragment page in <af:region> at runtime.
Basically our requirement is anyhow we want to add multiple panel which is having many other child component at run time.
Your suggestion will be very helpful.
Regards,
Deepak ParmarVinod,
Hmm.. only option left is i should add component at run time. but i am facing following issue...
I am trying to add child component into RichPanelStretchLayout object at runtime, but getFacetCount() and getFacet() method of RichPanelStretchLayout is returning 0 and null respectively.
can you please suggest me how can i add child component into RichPanelStretchLayout object?, i have directly added component using getChildered.add() method. but it wont work as i must need one facet object ( either START,BOTTOM or CENTER).
Regards,
Deepak -
Im wanting to make a photo gallery that I can update easy, I
thought if I could have a movieclip load external images for my
thumbnails it would be nice but Im not sure how to set it up. I
would make a file for my images and then another for my thumbnails,
then if or when I want to switch out pictures I'd just have to drop
new images into my folders and not even touch the FLA. Could anyone
point me in the right direction with the right action script to use
or a tutorial that explains how this is done..
And when I say load external I want it so I dont have to
click on the image for it to load, I want it to just load
automatically , I would put an invisible button or something to
that efect over the images for a animated effect.
Thanks for your help.I don't know if you are super enthusiastic about building it,
or if you just want the utility. If the later is the case, I just
purchased (cheap) a really great product that does all of what you
want, fairly automatically, including scaling large pictures down
to smaller size so that they load quickly.
I am not sure of the policy of recommending third-party
applicatons here. So, if you are interested, send an email (private
message) to me and I will show you the simple site I put together
using it and where to get it. -
hi,
I need to load an external image and resize it and load also
external text down of image.
swi files should be fantastic reponse for me
thanks in advise
asapUnfortunately the Tecra S2 isn't capable to display the resolution 1400x1050.
Here are the resolutions you can use.
Support Resolution/Color(CRT)
640x480 16bit/32bit colors(Depending on CRT)
800x600 16bit/32bit colors(Depending on CRT)
1024x768 16bit/32bit colors(Depending on CRT)
1280x1024 16bit/32bit colors(Depending on CRT)
1400x1050 N/A
1600x1200 16bit/32bit colors(Depending on CRT)
1920x1440 16bit/32bit colors(Depending on CRT)
2048x1536 16bit/32bit colors(Depending on CRT)
May you find an enhanced but not official driver here: http://www.laptopvideo2go.com/enhancer -
SQL LOADER , EXTERNAL TABLE and ODBS DATA SOURCE
hello
Can any body help loading data from dbase file .dbt to an oracle 10g table.
I tried last day with SQL LOADER, EXTERNAL table , and ODBC data source.
Why all of these utilities still failing to solve my problem ?
Is there an efficient way to reach this goal ?
Thanks in advanceexport the dbase data file to text file,
then you have choice of using either sql loader or external table option to use.
regards -
Pre-loading external images for XML-based gallery
I'm working-on an XML-based photo gallery here:
http://www.unionandparkwood.com/demo/flash_gallery/
It works how I want it, except that the first time a
thumbnail is clicked for an image, it pauses long enough to skip
the fade. If you click-through the images a second time, you'll see
that it works smoothly. My guess is that the first time the
thumbnail is clicked, the image isn't cached, yet.
I tried to fix this by creating a JavaScript file for the
page to pre-load each image and thumbnail:
0003a = new Image;
0003a.src = "images/Down-Range.jpg";
0003b = new Image;
0003b.src = "thumbnails/Down-Range.jpg";
But that didn't work. What would be the best way to do this?
I included a link to "Download ZIP" of the FLA project on
this page, too, because it wouldn't be easy for me to describe
what's happening. In a nutshell, a thumbnail click launches a
function that loads the appropriate image into the main image
holder. What seems to be happening the first time is the image
isn't loaded before the fade is finished, so the image just appears
after a short pause the first time.>>What seems to be happening the first time is the
image isn't loaded before
>>the fade is finished, so the image just appears after
a short pause the
>>first time.
As has been said many times in thos forum - use the
MovieClipLoader class to
load images, and then use that class' onLoadInit method to do
things with
the loaded image. Loading is asynchronous - you _have_ to
wait until the
image is done loading before doing a fade.
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
Unable to load external image into iOS app with AS3
Just trying out Flash Builder for iOS app development and have run into a problem right off the bat with loading an external image into an iOS app. The actionscript is very simple (this was basically my Hello World attempt), and I'm hoping someone here can explain where I'm going wrong. This code works in Flash Pro, and works when launched on the desktop from Flash Builder, but doesn't work on my iOS devices.
Here's the code:
var container:MovieClip = new MovieClip();
addChild(container);
var imageLoader:Loader = new Loader();
imageLoader.load(new URLRequest("http://www.google.ca/intl/en_ALL/images/logos/images_logo_lg.gif"));
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, startListener);
function startListener (e:Event):void{
container.addChild(imageLoader);
Any thoughts on why this won't work would be greatly appreciated!I had the same issue, and modified my domain policy file as specified in http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html#_Configuring_URL_M eta-Policies but the loader is not loading the file. Any ideas on how to fix this issue?
-
Photoshop open multiple image and add different texts
Hi All,
Hope you are all doing great. I just started doing photoshop scripting due to the requirement which I will mention in detail below.
My scripting is knowledge is very basic so I was hoping you guys could be able to help me out with this.
The requirment is that I have 100's of images which needs to be opened in photoshop and add text based on the image name then save the image as JPEG at 70 quality. For example:
I have images named as below in my desktop folder,
Image1.jpg
Image2.jpg
Image3.jpg
Image4.jpg
Image5.jpg
Image6.jpg
Image7.jpg
Image8.jpg
Image9.jpg
Image10.jpg
For the script, I think the easiest way is that if I define what image name are:
image[1] = Image1.jpg
image[2] = Image2.jpg
image[3] = Image3.jpg
image[4] = Image4.jpg
image[5] = Image5.jpg
image[6] = Image6.jpg
image[7] = Image7.jpg
image[8] = Image8.jpg
image[9] = Image9.jpg
image[10] = Image10.jpg
and for text I have done this:
text [1] = Image1
text [2] = Image2
text [3] = Image3
text [4] = Image4
text [5] = Image5
text [6] = Image6
text [7] = Image7
text [8] = Image8
text [9] = Image9
text [10] = Image10
So everytime when I run the script image1 will be added to the photoshop and the text name Image1 will be added (For this I think defining layer name would be better so I will gave "Imagetext").
Then the image will be saved on a specific location on my desktop.
I have all this plan on what I want to do but I don't know how to write the script using photoshop API and my limited javascript coding.
So if you guys could help me out with this, that would be awesome. Hope to hear on this soon.
Kind Regards,
ZoogleHi Ghoulfool,
Thank you very much for taking your time in looking into my question.
Also thanks for the script you've provided. Your script works perfectly close to my requirements but there are few minor addon that I would like to request please.
My apologies for not being very clear
First of all to answer your questions:
Image size varies but mostly between 1200-1000 pixels.
Good question regarding text size, I would like to control the size of the text based on how long the character length is.
Position varies so I would like to adjust it manually or if I could definie within the script that would be superb.
The images open in new window rather that staying in the currently opend psd, I have other layers which I need to keep it as static and use the script to add the image between these layers.
I wouldn't mind if all these 100's of images stay in current psd as layers.
I was hoping if possible I would have more control over what text I would like to put on the image.
Below is the example , I am sure the code below is wrong but with my limited scripting that's all I could come up with
This is the code that would be controlling what text/text size appear on images based on the i value:
var publicPath = 'C:/Users/Username/Desktop/imagesavetest';
var outputPath = publicPath;
var imagetext = new Array();
imagetext[0] = "imagetext0";
imagetext[1] = "Apple";
imagetext[2] = "imagetext2";
imagetext[3] = "Pineapple";
imagetext[4] = "Orange";
imagetext[5] = "imagetext5";
imagetext[6] = "imagetext6";
imagetext[7] = "Berries";
for (var i in imagetext) {
textLength = imagetext[i].length;
saveMyFile = imagetext;
theText.contents = imagetext[i].toUpperCase();
switch (true) {
case textLength <= 9:
theText.font = "Arial";
theText.size = 38;
theText.contents = imagetext[i].toUpperCase();
break;
case textLength > 9 && textLength <= 12:
theText.font = "Arial";
theText.size = 28;
theText.contents = imagetext[i].toUpperCase();
break;
saveAsJPEG(outputPath, saveMyFile);
counter++;
And to open files from the user defined location:
var inFolder = new Folder("C:/Input")
var image = new Array();
image[0] = "image0.jpg";
image[1] = "image1.jpg";
image[2] = "image2.jpg";
image[3] = "image3.jpg";
image[4] = "image4.jpg";
image[5] = "image5.jpg";
image[6] = "image6.jpg";
image[7] = "image7.jpg";
for (var j in image) {
if j=0 look for i=0 and add i value as text
To simplify i'll open psd with layers, add image between existing layers and add text based on the text name which we defined in script.
Sorry for long post, but hope I have not made this simple process confusing.
Please do let me know if you have any questions. Hope you hear from you soon and Thanks for your time.
Kind Regards,
Zoogle. -
developing a ui in flash for photo gallery which I am loading
into dreamweaver.
using as3 in flash to load external photo files so not all
having to download on opening.
have had no problem in dreamweaver with swfs with embedded
jpgs.
ui comes up in dreamweaver but not external files. even
though when I open swf movie or the flash created html of same
file, on its own, no prob.
anyone run across this problem, jpgs are in same file as
flash media, also dropped them into image file just in case that
might work---no go
any ideas ?your isse begins here ..
loadSection()
you use the same loader to not only load files but you are tyring to use it to target the movieClip you also want to play.
The issue is loader. The loader can only reference one load at a time.. otherwise you screw up your listeners and the ability to unload files properly.
You should load all files in Your current system as its own variable so that while one loads you can still control a movie.
So what type of end transitions do your files have?
What exactly with this seems like youre getting an issue.. looking at it looks alright aside from the fact that some methods are not used at all by your class -
Loading external Images in MovieClips
Dear All,
I am trying to load the external images in Dynamically
created Movie Clips.
Can you please help me out from this.
I am trying something like this:
Container_mc.image_mc ( I want to load the Images inside the
imag_mc clip)
Regards,
Sridhar B
Container_mc.image_mc
imag_mcHi,
Following is my problem:
I am trying to trace the "idValue" property on runtime but it
is showing error. Can you please tellme how add Images and
properties runtime.
var loader:Loader = new Loader()
addChild(loader)
loader.load(new URLRequest("images/01.png"))
// Assigning a value to idValue property
mc_mainSWF.idValue = 40
mc_mainSWF.addChild(loader)
mc_mainSWF.addEventListener(MouseEvent.CLICK, checkID)
function checkID(event:MouseEvent)
// And i am geeting error here
trace(event.target.idValue)
Regards,
Sridhar B -
Load external image & text into SWF
Can someone point me to a tutorial on how to create a
template that will load an external image file,.css styled text
& a .css style sheet into a .swf by using .xml?
Thank you for your time.
CKYou can use the MovieClipLoader class to load multiple images sequentially (one at a time), but you wouldn't use a 'for' type of loop...instead you would use a recursive loop, where a loading function is called after each load completion until all loading in done. This is done by utilizing a load-complete listener to trigger loading of the next image. So you start the loading process by loading one file, when that file is determined to be loaded, the listener proceses that file in whatever way you need to prepared (resizing, etc) and triggers the loading of the next file.
If you look up the MovieClipLoader.addListener method in the Flash help documents there is an example there that uses the onLoadInit event. You would be wanting to use the onLoadComplete event.
Maybe you are looking for
-
Migrate documents from the windows file server into km
Hi All, I have around 100 GB of documents in a file server and i want to migrate the same data in to KM. I am sure that there should be some standard process to do this,can any one please help me out in solving this. Thanks Ajay
-
Purchase and consumption quantity for ISO 14001
Hello! We need the summary of purchase and consumption quantity of some material groups for a ISO 14001 report. Is there a standard report in ECC 6.0 EHP5? Best regards Markus
-
HT1311 how to change the payment from visa to none payment iPhone 4S
how to change the payment from visa to none payment iPhone 4S
-
I like to collect old Macs for future use as antiques. Where are some good places to find them? I know people recycle them all the time, but I don't know how to get to them before they're demolished. I have gotten only 5 of them from recycle bins.
-
Navigation bar does not appear on published page, Replaced by a "bullet"
Navigation bar does not appear on the published page, but is replaced by a "bullet". "Include page in Navigation menu" is checked on every page. Therefore unable to navigate to other pages. If other pages are moved to the first position, the same thi