Can You Tell Images Created At Author Time To Load Dynamically?
hello, I have many images in my movie which I just imported onto the stage and positioned manually, but now the site loads slow. Can I tell all the images to load dynamically with some lines of AS or a publish option or something else or do I have to replace all images with placeHolder-MovieClips and use the loadMovie command to dynamically load the images? Many Thanks !!
SitePoint > Design Your Site > Flash and Actionscript
Posted on: May 1, 2004, 16:58
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Can You Tell Images Created At Author Time To Load Dynamically?
hello,
I have many images in my movie which I just imported onto the stage and positioned manually, but now the site loads slow. Can I tell all the images to load dynamically with some lines of AS or a publish option or something else or do I have to replace all images with placeHolder-MovieClips and use the loadMovie command to dynamically load the images?
Many Thanks !!
Can You Tell Images Created At Author Time To Load Dynamically?
hello,
I have many images in my movie which I just imported onto the stage and positioned manually, but now the site loads slow. Can I tell all the images to load dynamically with some lines of AS or a publish option or something else or do I have to replace all images with placeHolder-MovieClips and use the loadMovie command to dynamically load the images?
Many Thanks !!
Communicate Between Author Time Created Movie Clips
Hello All,
I am new to AS 3 and need to figure out how get some Movie Clips to communicate with with each other or with the Main timeline (Scene 1) .
I have created two movie clips during author time not dynamically
- a movie clip instance named menu_mc and a movie clip named screen_mc.
Inside menu_mc are buttons that I have 'wired' to communicate with a movie clip on the main stage/main timeline .
How can I successfully reference the 'main' timeline and/or the 'screen_mc' clip.
So far the only thing that works is:
this.parent["screen_mc"].gotoAndStop("flower") ; // <-- (Script is written in a keyframe inside menu_mc)
Any help is much appreciated as this was so easy to achieve in AS 2.
How Dynamically Change The Image In Dynamically Created Row Of Images?
Hi everybody,
I am wondering if someone can help me to find out on how to replace the images in row of dynamically loaded images. I need on Press of an icon from the row of images replace the image of this icon to new one. Below is the code of creating the images row based on array and XMl data. I create an array based on data taking from XML.
Code:
var numOfImages:Number;
var thumbHeight:Number = 8;
var thumbSpace:Number = 100;
var thumbTotalDistance:Number = thumbHeight+thumbSpace;
var xCounter:Number = 5;
var thumbsCollectionHeight:Number;
var currentImage:Number = 0;
var moveOutDist:Number = 10;
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
var IM_Img:Array = new Array();
var IM_Title:Array = new Array();
//==================================================================================================================
//=============================== THUMBS IMAGE LOADER ==========================================================
//==================================================================================================================
var thumbImgLoader2:MovieClipLoader = new MovieClipLoader();
var thumbImgListener2:Object = new Object();
thumbImgListener2.onLoadProgress = function(target:MovieClip):Void {
};
thumbImgLoader2.addListener(thumbImgListener2);
thumbImgListener2.onLoadComplete = function(target_mc:MovieClip):Void {
};
//==================================================================================================================
//=============================== XML ==================================================================================================
//==================================================================================================================
var totalXML:XML = new XML();
totalXML.ignoreWhite = true;
totalXML.onLoad = function(success) {
var TNnode = this.firstChild.childNodes[1].childNodes;
numOfImages = TNnode.length;
//---------------- ATTACHING THUMBS -----------------
//===========================================================================================================
for (i=0; i<numOfImages; i++) {
var mc:MovieClip = imCollection_mc.thumbs_mc.attachMovie("mcThumb_IM", "thumb_" + i, i);
mc._y = 0;
mc._x = xCounter;
xCounter = xCounter+thumbTotalDistance;
thumbImgLoader2.loadClip(TNnode[i].attributes.thumb,mc.loader_mc);
IM_Title.push(TNnode[i].attributes.title);
imCollection_mc.thumbs_mc["thumb_" + i].mc_title.title_txt.text = IM_Title[currentImage];
mc.id = i;
trace (mc.id);
mc.onPress = mc_im_onPress;
mc.xx = mc._x;
mc.yy = mc._y;
}
};
//-------------------------------------------------------------------------
totalXML.load("images.xml");
Here is onPress event where I was thinking to add this functionality:
Code:
function mc_im_onPress() {
mcToSelect = this;
if(this.id==8){
//here I need to tell to replace the image from mc8 to new image from array to image#34 from xml
}
}
Any advice is highly appreciated. Thanks.
Getting A “Dynamically Created” Text Field To Change _alpha At Run Time
Here’s the problem.
I have a script that dynamically creates a text field at run time & I would like to get it’s _alpha to decrease on say a standard keyframe script.
From searching the forums the only way I have seen that comes close to achieving this is to use the “Embed Font” option which as far as I know can only be achieved at authoring time & not done dynamically.
Anyone any ideas please?
I have seen mention to a tut that may solve the problem in one of the posts but can find no reference to it when searching
Loading Images Into Dynamically Created Buttons
Hi everyone,
I'm looking for a way to load images into dynamically created buttons. I'm not sure how I can load separate pictures into the mouse over frames etc. I'd just like to know what the real syntax is for the below - I've obviously faked it with the onkeyup etc just to show what I mean. There's a potentially limitless number of buttons, but I just want the basic idea so I can get it looping etc.
code:
this.attachMovie("mc_button","button1",75);
this.button1.onkeyup.attachMovie("emptyMovieClip", "clip1",100);
this.button1.clip1.loadMovie("http://localhost/pic_up.gif");
this.button1.onkeydown.attachMovie("emptyMovieClip ","clip2",100);
this.button1.clip2.loadMovie("http://localhost/pic_dn.gif");
Thanks
Loading Images In Dynamically Created MC Issue
Hello !
i've been confronting myself to this issue for 5 hours now, i'm in need of help from the outside world
i'm trying to load a series of external jpg images.
What to be loaded is stored in an external xml file, which indicates the folder along with the file name pattern and the number of images. This is handy since images are numbered incrementally (image_1.jpg, image_2.jpg...)
Finally, i need to position these images as a strip, that is, one next to each other horizontally.
I get the info out of the xml file without issue, the url are correct (if i paste them in the browser, i see the image file) yet, it seems there is an issue with my loading mc code. Can you check and tell me what i'm doing wrong please?
ActionScript Code:
function doStrip(obj:XML)
{
var project = obj.firstChild;
var sequences = project.childNodes;
var project_width:Number = 0;
var pointerXpos:Number = 0;
var totalImageCounter:Number = 0;
var stripContainer:MovieClip = this.createEmptyMovieClip("stripContainer", this.getNextHighestDepth());
stripContainer._x = 0;
stripContainer._y = 0;
stripContainer._height = 200;
for (var i = 0; i<sequences.length; i++)
{
var folder:String = sequences[i].attributes['folder'];
var numOfImages:Number = Number(sequences[i].attributes['numOfImages']);
var type:String = sequences[i].attributes['type'];
var namePattern:String = sequences[i].attributes['namePattern'];
var imgWidth:Number = Number(sequences[i].attributes['imgWidth']);
var sequenceWidth:Number = Number(numOfImages*imgWidth);
project_width += sequenceWidth;
for (var j = 1; j<=numOfImages; j++)
{
totalImageCounter++;
var filename:String = namePattern.replace('#', j);
var fileToLoad:String = absoluteUrl+'/'+project_folder+'/'+folder+'/'+filename;
pointerXpos = Number(pointerXpos+imgWidth);
instance = 'image'+totalImageCounter;
var myimg:MovieClip = stripContainer.createEmptyMovieClip(instance, stripContainer.getNextHighestDepth());
myimg.loadMovie(fileToLoad);
myimg._x = pointerXpos;
}
}
}
Thanks a lot in advance, i look forward to reading your advises!
Loading Images In Dynamically Created MC Issue
Hello !
i've been confronting myself to this issue for 5 hours now, i'm in need of help from the outside world
i'm trying to load a series of external jpg images.
What to be loaded is stored in an external xml file, which indicates the folder along with the file name pattern and the number of images. This is handy since images are numbered incrementally (image_1.jpg, image_2.jpg...)
Finally, i need to position these images as a strip, that is, one next to each other horizontally.
I get the info out of the xml file without issue, the url are correct (if i paste them in the browser, i see the image file) yet, it seems there is an issue with my loading mc code. Can you check and tell me what i'm doing wrong please?
ActionScript Code:
function doStrip(obj:XML){ var project = obj.firstChild; var sequences = project.childNodes; var project_width:Number = 0; var pointerXpos:Number = 0; var totalImageCounter:Number = 0; var stripContainer:MovieClip = this.createEmptyMovieClip("stripContainer", this.getNextHighestDepth()); stripContainer._x = 0; stripContainer._y = 0; stripContainer._height = 200; for (var i = 0; i<sequences.length; i++) { var folder:String = sequences[i].attributes['folder']; var numOfImages:Number = Number(sequences[i].attributes['numOfImages']); var type:String = sequences[i].attributes['type']; var namePattern:String = sequences[i].attributes['namePattern']; var imgWidth:Number = Number(sequences[i].attributes['imgWidth']); var sequenceWidth:Number = Number(numOfImages*imgWidth); project_width += sequenceWidth; for (var j = 1; j<=numOfImages; j++) { totalImageCounter++; var filename:String = namePattern.replace('#', j); var fileToLoad:String = absoluteUrl+'/'+project_folder+'/'+folder+'/'+filename; pointerXpos = Number(pointerXpos+imgWidth); instance = 'image'+totalImageCounter; var myimg:MovieClip = stripContainer.createEmptyMovieClip(instance, stripContainer.getNextHighestDepth()); myimg.loadMovie(fileToLoad); myimg._x = pointerXpos; } }}
Thanks a lot in advance, i look forward to reading your advises!
Alex
AS 2 Dynamically Created Images Disappear When Animated?
I'm creating a flash application which loads external images from an XML file and places them in an animated slideshow, however - whenever i run the animation the external images (which have previously loaded completely) are replaced with the placeholder images that they replaced when loaded... if that makes sense?????
Basically there is a movie clip which includes the tweens and masks for the slideshow images, within this clip there is another one holding a background colour on layer 1 and another movieclip on layer 2. This movie clip on layer 2 holds a placeholder 'loading' movieclip which is then replaced with the external image when loaded. The external images load and display fine, however when the first clip is animated the 'loading' placeholder reappears.
All the movieclips are added to the stage programmatically and the external images only appear once they have fully loaded - I cannot work out a) why they are being replaced with the 'loading' movie that they loaded in place of and b) how to stop this happening!
Any help would be gratefully appreciated!
Caroline
Dynamically Author .swf Files
So,
What I would like to do is allow users to customize some aspects of a flash file, and then get emailed an animation with their personal touches. Let's say they can choose a background, a message, and a type of animation. They would input these options into a flash form, and in return, get emailed a .swf with the options they chose. I am just starting on this, an initially I have seen some stuff dealing with PHP, but at first glance, this seems to work in the browser, but not to actually be able to save a .swf in the end. Any ideas on this?
-B
Accessing Author Time Instances By Name
Hi,
I am trying to control the timeline of a movie clip (created at author time) which is nested within another movie clip.I have the flash compiler set to automatically declare stage instances and when I debug, I can see the children underneath the parent object, and they are not null.
I'm using: getChildByName(...) as Movie Clip
But when I try to do anything with the movie clip I get the Error 1009 ...null object reference...The object is does not appear to be null, although FP says it is. Any help or guidance to a resource on this type of thing would be great. Thanks in advance
Help Mixing Author-time Animation With AS
I've been doing a fair bit of AS, and I thought I had this issue down, but maybe I'm too tired to get this right.
I'm trying to use some hand-built animations using objects and tweens on the timeline, where the animated object is an empty MovieClip. Some animations are movement, others are alpha fades. In the AS code, I am using attachMovie to attach another movieclip from my library to the animated container object.
However, when I run it, the author-time tweens appear to be ignored. The
container does not animate, nor does its attached child movie.
Is there a good resource or example for how to accomplish this. I want to do some complex animations by hand and then reuse them for various photos.
thx,
BR
SwapDepths On An Author Time Movieclip
I have a movie clip on a timeline. On frame 1 it's at scale 100 and at frame 5 it is scaled up. I need to swap the depth of this movieclip at runtime so I am using swapDepths. Before I call swapDepths, if I go to frame 5 the movieclip scales up as it should, but after I call swapDepths on this author-time created movieclip it seems to reset all its properties and now when I say gotoAndStop(5) the movieclip no longer scales up. It's as if a new instance of the movieclip was created at a positive depth level. I am looking for an alternative to dynamically attaching this movie clip because I don't want to hard-code the position and scale values. I am working with some non-programmer artists so I want to make it easy for them to position the movie clip as they see fit without altering the code. Any suggestions? Thanks a lot.
Using Load In Dynamically Created Movieclips
Hi,
I'm new to Flash, although I do have some experience of scripting an actionscript does appear to be a lot like java, so i'm getting there slowly.
Basically my problem is I'm trying to create a piece of flash that substitutes a movieclip based on a parameter passed to it from HTML (this bit I can get working), the problem is I want to load the movieclip in dynamically and attach a load event to the dynamically created clip so I can make use of an orbiting script I have used before.
Here is my code:
Code:
_global.severity = severity;
_global.errortype = errortype;
_root.onLoad = function() {
trace ("_root onLoad called");
//Create our Clip
_root.createEmptyMovieClip("errordisplay", 1);
//Attach event to clip.
errordisplay.onLoad = LoadOrbit;
//loadMovie(LoadSeverity(), "errordisplay");
//As a test I just want to make this line work before loading the Clip
//corresponding to the parameter passed from the PHP page.
errordisplay.attachMovie("warning_movie", "warning_movie1", 1);
errordisplay._x = 80;
errordisplay._y = 80;
errordisplay.onEnterFrame = Orbit;
};
//For the object function to work both the Clips Load and EnterFrame
//events need to fire.
LoadOrbit = function() {
trace ("errordisplay onLoad called");
depthset = true;
playclip = false;
offsetx = 10;
offsety = 45;
y = 0;
speed = 5;
radius = 130;
xcenter = _level0.LM._x + offsetx;
ycenter = _level0.LM._y - offsety;
zcenter = 100;
angle = 0;
fl = 150;
};
Orbit = function() {
//trace ("Orbit called");
z = Math.sin(angle * Math.PI / 180) * radius + zcenter;
scale = fl / ((fl + z));
x = Math.cos(angle * Math.PI / 180) * radius;
setProperty ("",_x,x * scale + xcenter);
setProperty ("",_y,y * scale + ycenter);
setProperty ("",_xscale,scale * 100);
angle = angle + speed;
setProperty ("",_alpha,scale * 100);
if (angle > 359) {
angle = angle - 360;
}
if (scale < 0.7) {
if (depthset == false) {
_level0.LM.swapDepths(this);
depthset = true;
}
} else {
if (depthset == true) {
_level0.LM.swapDepths(this);
depthset = false;
}
depthset = false;
}
};
//This decides what clip to run based on a gloabl variable being set.
function LoadSeverity() {
switch (severity) {
case 16:
swfname = "critical.swf";
break;
case 48:
swfname = "warning.swf";
break;
case 64:
swfname = "information.swf";
break;
default:
swfname = "warning.swf";
}
return swfname;
}
Basically I've seen a lot about this problem but no real solution, the Load event never fires so you never see the trace message in the output window when testing, however the EnterFrame event does fire, but because the variables are not set correctly in the Load event the clip will not orbit lke it should.
Please help!
Referencing Author Time Buttons On The Stage?
I have some buttons on the stage that were manually placed during authoring. They all have their own instance names manually assigned already. I need to code them thru my Document Class. How do I get reference to them?
I know how to do this if I am placing them from the library at runtime, but not this way.
Thanks
How Do I Load Text Into My Dynamically Created Textfields?
Hi again Flashgurus!
I'm using the following code to create a function that creates a dynamic textfield:
function makeText() {
createTextfield("textBox", 50, 4, 3, 371, 43);
textBox.background = true;
textBox.border = true;
textBox.backgroundColor = 0xFFFFFF;
textBox.borderColor = 0x000000;
textBox.multiline = true;
textBox.wordWrap = true;
textBox.autoSize = true;
textBox.variable = "txt";
// formatering
myFormat = new TextFormat();
myFormat.font = "Impact";
myFormat.size = 15;
myFormat.color = 0x666666;
textBox.setNewTextFormat(myFormat);
}
In my different movieclips I call the function like this:
_root.makeText(this);
and the textfield, "textBox" , with the variable "txt" is created.
As there are different texts to be loaded in different textfields (in different movieclips that are loaded by a random script), I can't use the function "makeText" to load the texts. I must load the right, specific text in the right, specific movieclip when that movieclip is loaded (and the textfield is created, ofcourse).
So here's the question:
How do I load text into "textBox" from my external textfiles?!
I know how this works when I make textfields manually, but now I'm stuck. As I'm using about 40 different movieclips and I want to be able to change the formatting of the textbox I really want to use my function.
Please help me, oh, You FlashGurus!
Load A Dynamically Created List Of Movies
hello... first off I am very new to actionscript..and in fact dont use flash...I pretty much just write code...but do work with people who create flash movies...but they dont code...so here I am.
A little info of what I am doing... I have an algorithm that will generate a list of X number of Advertisements (lets set at 5) to be displayed on a web page repeatedly during the users session (all ads are done in flash). What I need to do is grab this list and have them run...
what is currently being done is our marketing department decides what to advertise and our flash guy creates a movie that contains all the advertisements in it... so if things change daily ...he would have to make changes daily... im trying to make things a little more automated...
the website is www.uces.csulb.edu
thanks for any help....
oh yeah...I guess what im looking for is some code or some place to read info on how to do this...
Actionscript Used To Load Dynamically Created Swf Files
Hi there
Trying to load dynamically created swf files into flash using the following action script. The swf are created from jpegs using php to convert to swf. The movies are named in series fire1, fire2 etc...
What syntax is necessary to automatically call the next swf into flash, meaning fire2.swf, fire3.swf etc.....?? thanx
for (i=1; i<4; i++)
{
loadMovieNum("fire1.swf", 1, "POST");
}
[F8] Embedding For Foreign Languages-runtime And Author Time
oh oh- never thought i would have to ask this...i am doing a site in English, Italian , and French....this word: "Événements" has clearly proven i don't know how to embed fonts outside of Latin English...All i get is nements. Now, i have some text boxes on stage from authoring time, and some created at run time....what do i need to do to cover all bases for all text boxes...it's impossible to say which of the boxes will use words such as "Événements"
or is the problem my xml??
Code:
<menubutton label="Services" sub0="Traductions" sub1="Événements" sub2="Faits sur commande">Service au francaise......you have to put the french things here.</menubutton>
Author Time, Attach Components By Drag And Drop.
I want to build a component that provides a set of behaviors, the component can be added to anyone's library, and then dragged onto any movie clip on the stage in the authoring environment. When dragged onto a movie clip the component is attached to that movie and may add its behaviors to, or modify, the target movie.
Is this possible without asking my users to enter actionscript to make the connections? Any ideas or pointers?
I have not been able to find any concrete examples of something like this in action.
Thanks,
-BarryFM
Load External Movies From Dynamically Created Buttons
I'm dynamically creating buttons for review to the user. The buttons are determined from test questions that they missed and the missed questions are stored in an array called categories. There can be multiple instances of the same name inside the category array so I'm weeding them out into the holder array so that there is only one occurrence of each category. The problem lies with my onRelease section of the code. All of the buttons and labels are created fine. The onRelease section of the code doesn't work properly. It makes all of the buttons load the same external movie. The external movie that is the last value in the array. Help please!
Quote:
stop();
var holder:String;
var holderArray:Array = new Array();
for (i = 1; i < categories.length; i++) {
holder = categories[i];
var arrayCount:Number = 0;
for (k = 0; k < holderArray.length; k++) {
if (holder == holderArray[k]) {
arrayCount++;
}
}
if (arrayCount == 0) {
holderArray.push(holder);
}
}
/************************************************** *************************/
function makebuttons(){
//if there are buttons, we will remove them first
if(_global.createdClips.length>0){
clearbuttons();
}
addbuttons(howmany);
}//end of makebuttons
function addbuttons(howmany) {
//array used to store movieclip information
_global.createdClips = new Array();
for(i=1;i<howmany;i++){
myButton = this.createEmptyMovieClip("btn"+i,i+20)
myButton.lineStyle(1);
myButton.beginFill(0x007EC3);
myButton.lineTo(20,0);
myButton.lineTo(20,20);
myButton.lineTo(0,20);
myButton.lineTo(0,0);
if((i*35+120) > 500) {
this["btn"+i]._x = 375;
this["btn"+i]._y = i*35-230;
} else {
this["btn"+i]._x = 100;
this["btn"+i]._y = i*35+120;
}
myButton.createTextField("txt"+i,i+21);
myButton["txt"+i].text=i;
//push the movieclip information into the array
_global.createdClips.push(myButton);
//=============we create a textfield to store the caption ====================================
myButton.createTextField("text"+i, 0, 30, 4, 230, 20);
myButton["text"+i].multiline = false;
myButton["text"+i].wordWrap = false;
myButton["text"+i].border = false;
myButton["text"+i].background = false;
myButton["text"+i].variable = "";
myformat = new TextFormat();
myformat.font="arial";
myformat.size="11";
myformat.color = 0x000000;
myformat.bullet = false;
myformat.underline = false;
myButton["text"+i].text = topics[holderArray[i]];
myButton["text"+i].setTextFormat(myformat);
_global.createdClips.push(myButton);
//This attempt has the same result as the attempt below
/*for(j=1;j<holderArray.length;j++) {
//trace(topics[holderArray[j]]);
var movie:String = holderArray[j];
//trace(topics[movie]);
this["btn"+j].onRelease = function () {
loadMovieNum(topics[movie] + ".swf", 100);
}
}*/
//This works but all the buttons open up the last array value
var movie:String = new String();
movie = topics[holderArray[i]] + ".swf";
//trace(movie);
myButton.onRelease = function(){
//trace(holderArray[i]);
loadMovieNum(movie, 100);
}
}//end of for loop
}//end of addbuttons
function clearbuttons() {
for(var myButton in _global.createdClips){
_global.createdClips[myButton].removeMovieClip();
//clear the array of movieclip information
_global.createdClips.pop();
}//end of for loop
}//end of clearbuttons
/*---------------------------------------------------------------*/
var howmany:Number = holderArray.length;
var topics:Array = new Array();
//Creates an array that corresponds with holderArray
//The values are output for users to see and also
//are the same as the external swfs that I want to load
topics["about"] = "About our Company";
topics["schedule"] = "Work Schedule";
topics["overtime"] = "Overtime";
topics["attendance"] = "Attendance";
topics["clockin"] = "Clocking In";
topics["glasses"] = "Safety Glasses";
topics["employeeSafety"] = "Employee Safety";
topics["fireExits"] = "Fire Exits";
topics["dropRule"] = "Knife Drop Rule";
topics["firstaid"] = "First Aid";
topics["drugs"] = "Drug, Tobacco and Alcohol-Free Workplace";
topics["harassment"] = "Harassment";
topics["reviews"] = "Performance Reviews";
topics["advancement"] = "Opportunites for Advancement";
topics["lockers"] = "Lockers";
topics["dresscode"] = "Dress Code";
topics["workstation"] = "Workstation";
topics["board"] = "Bulletin Board";
makebuttons();
Load External Movies From Dynamically Created Buttonsd
I'm dynamically creating buttons for review to the user. The buttons are determined from test questions that they missed and the missed questions are stored in an array called categories. There can be multiple instances of the same name inside the category array so I'm weeding them out into the holder array so that there is only one occurrence of each category. The problem lies with my onRelease section of the code. All of the buttons and labels are created fine but the buttons don't do anything! Help please!
Quote:
stop();
var holder:String;
var holderArray:Array = new Array();
for (i = 1; i < categories.length; i++) {
holder = categories[i];
var arrayCount:Number = 0;
for (k = 0; k < holderArray.length; k++) {
if (holder == holderArray[k]) {
arrayCount++;
}
}
if (arrayCount == 0) {
holderArray.push(holder);
}
}
/************************************************** *************************/
function makebuttons(){
//if there are buttons, we will remove them first
if(_global.createdClips.length>0){
clearbuttons();
}
addbuttons(howmany);
}//end of makebuttons
function addbuttons(howmany) {
//array used to store movieclip information
_global.createdClips = new Array();
for(i=1;i<howmany;i++){
myButton = this.createEmptyMovieClip("btn"+i,i+20)
myButton.lineStyle(1);
myButton.beginFill(0x007EC3);
myButton.lineTo(20,0);
myButton.lineTo(20,20);
myButton.lineTo(0,20);
myButton.lineTo(0,0);
if((i*35+120) > 500) {
this["btn"+i]._x = 350;
this["btn"+i]._y = i*35-230;
} else {
this["btn"+i]._x = 100;
this["btn"+i]._y = i*35+120;
}
myButton.createTextField("txt"+i,i+21);
myButton["txt"+i].text=i;
//push the movieclip information into the array
_global.createdClips.push(myButton);
//=============we create a textfield to store the caption ====================================
myButton.createTextField("text"+i, 0, 30, 4, 230, 20);
myButton["text"+i].multiline = false;
myButton["text"+i].wordWrap = false;
myButton["text"+i].border = false;
myButton["text"+i].background = false;
myButton["text"+i].variable = "";
myformat = new TextFormat();
myformat.font="arial";
myformat.size="11";
myformat.color = 0x000000;
myformat.bullet = false;
myformat.underline = false;
myButton["text"+i].text = topics[holderArray[i]];
myButton["text"+i].setTextFormat(myformat);
_global.createdClips.push(myButton);
//One attempt at the onRelease loading external movies
/*for (j=1;j<holderArray.length;j++) {
trace(topics[holderArray[j]]);
var movie:String = holderArray[j];
trace(topics[movie]);
myButton["btn"+j].onRelease = function () {
loadMovie(topics[movie] + ".swf", 100);
}
}*/
//Another attempt on dynamically loading external movies
/*myButton.onRelease = function(){
var movie:String = new String();
movie = topics[holderArray[i]] + ".swf";
//trace(movie);
trace(holderArray[i]);
loadMovie(movie, 100);
}*/
}//end of for loop
}//end of addbuttons
function clearbuttons() {
for(var myButton in _global.createdClips){
_global.createdClips[myButton].removeMovieClip();
//clear the array of movieclip information
_global.createdClips.pop();
}//end of for loop
}//end of clearbuttons
/*---------------------------------------------------------------*/
var howmany:Number = holderArray.length;
var topics:Array = new Array();
//Creates an array that corresponds with holderArray
//The values are output for users to see and also
//are the same as the external swfs that I want to load
topics["about"] = "About our Company";
topics["schedule"] = "Work Schedule";
topics["overtime"] = "Overtime";
topics["attendance"] = "Attendance";
topics["clockin"] = "Clocking In";
topics["glasses"] = "Safety Glasses";
topics["employeeSafety"] = "Employee Safety";
topics["fireExits"] = "Fire Exits";
topics["dropRule"] = "Knife Drop Rule";
topics["firstaid"] = "First Aid";
topics["drugs"] = "Drug, Tobacco and Alcohol-Free Workplace";
topics["harassment"] = "Harassment";
topics["reviews"] = "Performance Reviews";
topics["advancement"] = "Opportunites for Advancement";
topics["lockers"] = "Lockers";
topics["dresscode"] = "Dress Code";
topics["workstation"] = "Workstation";
topics["board"] = "Bulletin Board";
makebuttons();
Runtime Embedded Fonts Conflict With Author-time Text Fields
I've been struggling for a week now trying to find a way to use runtime embedded fonts -- Font.registerFont() -- for runtime created text fields, but still be able to have author-time created text fields in my projects. There are many issues with this. Here is what I have discovered thus far:I can successfully load in a font from an external Fonts.swf and use it to create and display text at runtime.
There does not seem to be any way to specify the use of that runtime loaded font for an author-time created text field.
If I have an author-time created text field on the stage that uses the same font, it completely breaks the use of the runtime loaded font for runtime created text. The way in which this breaks varies depending on the author-time created text field:If the field is a Static text field, runtime created text using the runtime embedded version of the same font does not appear at all.
If the field is dynamic, but does not have its font embedded (using the properties "embed" button), the runtime created text using the runtime embedded version of the same font does not appear at all.
If that text field is dynamic and does have its font embedded, it will create a duplicate entry for that font in the Font.enumerateFonts Array. This is a problem, because Flash will then default to using the version of the font embedded in its own .swf (the one from the author-time text field) rather than the one loaded in at runtime... even if the .swf version of the embedded font doesn't have all of the glyphs required to display the text! So you end up with a runtime created text field that will only display some of its characters.
When there are duplicates of embedded fonts, I cannot find any way to specify which version to use, because they are all referenced only by the original font name.
It seems utterly ridiculous to me that I have the fonts embedded and ready to be used, but that Flash gets all confused by author-time created text fields and thus makes the use of those embedded fonts for runtime created text impossible. Has anyone out there found a solution to these issues? Specifically:
- Is there a way to specify the use of a runtime embedded font in an author-time created text field?
- If there are duplicate embedded fonts (not really duplicates, but with the same fontName, fontStyle, and fontType... so indistiguishable) is there any way to specify which one a text field should use? If there is, I could do a check on each embedded font for Font.hasGlyphs() until I find the one that works and then specify that version.
Thanks in advance for any thoughts!
Attaching Multiple Images - Load Images One At A Time?
I have a photo gallery that loads many images using a for loop (image data is from XML file). Simplified code looks like this:
Code:
var photos_xml = new XML();
photos_xml.ignoreWhite = true;
photos_xml.onLoad = function(success) {
if (success) {
var photos = photos_xml.firstChild.childNodes;
var itemCount = 0;
for (var i = 0; i < photos.length; i++) {
var path = photos[i].attributes.path;
// attach the photos
var photo_mc = _root.center_mc.photosLevel1_mc.attachMovie("photoFrame_mc", photoName, itemCount);
photo_mc.empty_mc.loadMovie(path);
itemCount ++
...
Then on the photoFrame_mc clip I have a loading like:
Code:
onEnterFrame = function () {
loader_mc._visible = false;
var t = empty_mc.getBytesTotal();
var l = empty_mc.getBytesLoaded();
percent = Math.round((l / t) * 100);
if (l == t && t != undefined && t > 10) {
loader_mc._visible = false;
delete this.onEnterFrame;
} else {
loader_mc._visible = true;
if (isNaN(percent)) {
percent = 0;
}
loader_mc.percent_txt.text = 10 - Math.round(percent / 10);
}
};
So what happens now is that many images get attached at once and they are all loading at the same time.
What I'd like to do instead is to have them load one at a time. The first pass through the for loop attaches an image and then it loads, but it doesn't move on to the next image until the first one is done loading. Is that possible?
Or maybe is it better to let them load all at once? I just think that when the image count is very large it will really bog down loading so many images at once and it might be best to load one at a time. Please advise.
Images Load First Time, But Not The Second Time - Help
I have a function that loads an array of images defined by an XML file. Depending on what "page" you are on, a different childnodes set of images loads... this works great - the first time they are called.
But... if you click on another 'page' calling the same function (or the same page for the secont time), nothing.
The image names will trace, but nothing is shown.
There is a createEmptyMovieClip and loadMovie to show the images.
For other content in the movie, we have placed "clearing" functions that would reset the variables to "" (empty string). But what about for loaded images/mc's? I have tried
removeMovieClip
unLoadMovie
However, the loading images function is a bit confusing and I might not be sure what arguments to pass to the "clearImages" function.
Any direction is appreciated!! really stuck here!
Thanks
Dynamically Load Multiple FLVPLAYBACK : Not At Same Time...
Hi guys, I been fooling around with the progress and ready eventlisteners and I've loaded about five FLVPlaybacks dynamically into a container on my main scene using attachmov.
however, i find that they all load up at the same time and i just want to make it happen one after another.
now im using a for loop j=0;j<4;j++ to attach the flv's. I'm having trouble coming up with a plan to implement them loading clips one at a time instead of all at the same time.
any ideas? thanks a bundle.
D.O.
Load Images At A Certain Time
Does anyone know how to tell flash to display images/movies according a certain time?
like:
at 4-10am = display a "good morning" movie
7-11pm = dislay a "good night" movie
thanks alot!!
Images Don't Load First Time Through?
I have a star rating in my movie rater. It takes a variable and then runs it through a series of tests to determine which stars to activate.
Here's the code:
Code:
//Turning all the stars off as default
star1._visible = false;
star2._visible = false;
star3._visible = false;
star4._visible = false;
star5._visible = false;
//Turning the stars on based on user rating
if (rating == 5){
star1._visible = true;
star2._visible = true;
star3._visible = true;
star4._visible = true;
star5._visible = true;
}
if (rating == 4){
star1._visible = true;
star2._visible = true;
star3._visible = true;
star4._visible = true;
star5._visible = false;
}
if (rating == 3){
star1._visible = true;
star2._visible = true;
star3._visible = true;
star4._visible = false;
star5._visible = false;
}
if (rating == 2){
star1._visible = true;
star2._visible = true;
star3._visible = false;
star4._visible = false;
star5._visible = false;
}
if (rating == 1){
star1._visible = true;
star2._visible = false;
star3._visible = false;
star4._visible = false;
star5._visible = false;
}
I know there's an easier way to do this using loops and what not but the system is already in place so I'm gonna go ahead and leave it. the problem is when it first loads the first scene, no stars are displayed. Once you leave the first scene, all other scenes (first scene included) work fine.
Any idea how to make it work right off the bat?
How Can Load The Images Dynamically
How can i use the dynamic image in my movie. In the whats new setion of flash mx these guys are telling that now we can load the image dynamically but they havent provide any tutorial for this.
PLease tell me how to do this.
cheers
Ritesh
Dynamically Load Images
this may OR may not sound difficult but
if anyone has a link to a tutorial on
loading images dynamically to a flash
movie I would appreciate the direction.
The general problem is this;
To have a menu for images and as is obvious
after a link is pressed on the menu, the image loads,
BUT,
If the owner of the site wants to add new images
daily, then, all he would have to do is upload
the images to the server and the Menu would be updated
and the pic along with the menu item would be accessable.
About the menu, I am going to take care of that myself,
About the images, I will direct the owner of the site
to specifically name each new pic that he uploads,
so that Flash can go through the file each time it loads
and determine if there is another image in the file,
basically it would just loop once and count the number of images. so again, that is not my problem,
the problem is simply loading the data remotely...
Thanks in Advanced everyone
Load Images Dynamically
pls can someone tell me how i can upload images dynamically & also to have a motion for each image i upload.
is there a tutorial which i can go through as well
thanks
Dimuth
How To Load Images Dynamically?
Hi guys,
I'm making a small flash file that will randomly display a series of 10 logos, 1 at a time. I'm wondering how I set up a fla file where Average Joe Schmo can just upload a new logo to a directory, and it will be automatically inserted into the FLA file? Hope this makes sense, I know it's a pretty broad question but if anyone can point me in the right direction that would be great. thanks
Dynamically Load Images
I'm working on a site and I have to do my navigation header in flash for all of the content pages but I have a background image that I have to change on each page. So, instead of having a different swf for each page I'm trying to change the image by using an empty movieclip in one swf and somehow linking it with variable names. My problem is that I'm not savy with actionscripting in flash and I'm not sure the exact coding that I need to use. I named my mc variable with imageLoader and in my html coding I have it pulling the correct jpg and placing it in the imageLoader space but I have to tell the swf to place the jpg in that space...does this make sense to anyone?
Thanks so much!
Dynamically Load And Resize .swf Images.
Hi,
I'm needing to dynamically load in .swf images from folder on my server.
Once loaded, they need to be resized automatically so they look the same size as the mc I loaded them into.
Any ideas on how to accomplish this?
Thanks,
Dynamically Load Images In Flash 5?
I love the new feature of dynamically loading images with MX and was wondering if anyone has found a way to do it in 5. I am thanking anyone in advance for a reply.
Stream And Dynamically Load Images
I have a 1 MB swf movie. The reason it's so large is because of many jpgs. So I reduced the size of the movie by removing the jpgs and using loadMovie to insert them as the user moves through each frame. The problem is that there's a delay, sometimes a long delay, whenever an image is loaded, especially on a 56k modem.
Is there anyway to stream the images into the cache while the user is in prior frames. In other words, if the user is on Frame 1 looking at an image, how do I get the images on Frame 2 and Frame 3 to load before the user gets to those frames?
# Of Images In Folder To Load Dynamically
I'm loading images dynamically from a folder. Is there a way for the SWF to count the number of available images to load at run-time (so I don't have to specify before hand)?
Nick
Component Can Load Images Dynamically?
i have a component i purchased for flash that has images in it, since it is a component, can i still preload the images dynamically??... does loading them dynamically like music, make the file a lot smaller ? someone wants a slideshow with 40 images is that possible to do under 600k or so ?
thx
Dynamically Load Images With Transparency
I don't think this is possible, but i need to pull images from a folder on a website into flash that have a transparency. So i know you can dynamically build a list of jpg's and have the user select them, and then load them in. But i need an image type (like a gif) to load in with a transparency on it. Is this possible?
Thanks.
Dynamically Load Images For Menu
I'm creating an image slider menu. My client would like to swap out images in the future for his portfolio. When images are clicked a larger view will show up.
Can you load an image using geturl and then alter it position/ size/ etc...?
That way wehn he wants to replace an image he can just copy the new image to the server with the same name as the one he's replacing.
Load Faded Images Dynamically
Hi Everybody
I am creating a set of thumbnails which are all individual movieclips because of the animation which takes place, but I am having a problem trying to load in jpegs dynamically into a container using fade in and out.
I have tried a few downloaded bits of code but have had no luck.
I could do with some help, please
Dynamically Load Random Images
I have three rectangles I converted to movie clips named pichold1, pichold2, pichold3 and placed horizontally side by side on the stage. I want to use actionscript to dynamically load these images from an images folder. Each image is named "image#" (ex. image1, image2, image3, ...) I want the movie to be placed on a webpage that when a user visits the page, the movie will load random images and cycle through them displaying them in the movie clips. I also want to use some sort of transition effect to fade the images in and out, any help with this?
Load Dynamically Images For Thumbnail
Hi, I am trying to create a thumbnail and load images located in a 2D array filled with a XML.
pArray[x][5]= preview image
Here is a sample of the XML
Code:
<project id="0">
<name><![CDATA[Test1]]></name>
<date><![CDATA[01/01/01]]></date>
<technologie><![CDATA[AS2, AS3, Kek Chose]]></technologie>
<img><![CDATA[behappyfarmer_img.jpg]]></img>
<preview><![CDATA[/behappyfarmer_preview.jpg]]></preview>
<description><![CDATA[Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque sed lectus imperdiet felis tempus aliquet. Suspendisse sem nulla, faucibus eu, eleifend at, scelerisque vitae, elit. Donec luctus dui vel urna. Integer at diam. Donec et risus. Praesent vestibulum pede ut urna. In facilisis tempus magna. Cras quis dolor sed dui pharetra blandit. Pellentesque vel arcu a nisi consectetuer iaculis. Ut.]]></description>
</project>
here is my XMLLoader Class
Code:
import mx.utils.Delegate;
class com.cc.XMLLoader
{
private var _xml:XML;
private var xml_result:Array;
public var xml_loaded:Boolean = false;
public function XMLLoader(path:String){
this._xml = new XML();
this._xml.ignoreWhite = true;
this._xml.load(path);
this._xml.onLoad = Delegate.create(this, dataLoaded);
}
private function dataLoaded(sucess:Boolean):Void {
if (sucess) {
createArray();
}
}
private function createArray():Void {
var xmlroot:XMLNode = this._xml.firstChild;
var i:Number;
var j:Number;
this.xml_result = new Array();
for (i = 0; i < xmlroot.childNodes.length; i++) {
xml_result[i] = new Array();
this.xml_result[i][0] = xmlroot.childNodes[i].attributes["id"];
for (j = 0; j < xmlroot.childNodes[i].childNodes.length; j++ ) {
this.xml_result[i][j + 1] = xmlroot.childNodes[i].childNodes[j].firstChild.nodeValue;
}
}
this.xml_loaded = true;
}
public function getXML():Array {
return this.xml_result;
}
public function getToken():Boolean {
return xml_loaded;
}
}
Here is my class
Code:
import com.cc.XMLLoader;
import mx.utils.Delegate;
class com.cc.projects.Projects extends MovieClip
{
private var objXmlLoader:XMLLoader;
private var pArray:Array = new Array();
public var container : MovieClip;
public function Projects() {
objXmlLoader = new XMLLoader("../lib/xml/Projects.xml");
this.onEnterFrame = Delegate.create(this, getToken);
}
public function getToken() {
if (objXmlLoader.getToken() == true) {
delete this.onEnterFrame;
getArray();
}
}
public function getArray() {
/*
This is the part which is supposed to show every preview images of my xml. from 0.0 to 80.0 and so on.
*/
pArray = objXmlLoader.getXML();
var k:Number = 0;
var i:Number;
for (i = 0; i < pArray.length - 1; i++) {
container.createEmptyMovieClip("mc" + i, 100);
container["mc" + i].loadClip("../lib/img/projects/" + pArray[0][5],this);
container["mc" + i]._x = k * 80;
k++;
}
}
}
Can you please tell me why it doesnt works?
The problem is obviously from the getArray function. I know that if I call them by their name manually it works but I am trying to assign them a dynamic name and call them with it which doesnt work.. please tell me how I can do that.
Thank you.
Dynamically Load Images From Folder?
I'm trying to figure out how this flash file is pulling images from a folder.
http://www.andrewberg.com/photobrowser/afpb_flash.html
He included the PHP file, but didn't include the flash source file. I can't see how he's calling the PHP from the flash.
Does anyone have a clue to how he does it?
Thanks!
Dynamically Load Images Into Flash
Hi everyone, I'm new.
I'm not too experienced with flash, but I was recently making a website in flash (trying to get better at this) and I wanna be able to change images in the folder of the site directory as opposed to having to open the .fla file, change the images in flash, then recompile and re-upload the site (like I said I'm not too experienced, and this seems like the only way I know ).
Right now I have a movieclip symbol called 'dynamicIMAGE', its one frame with one line of actionscript applied:
loadMovie("image.jpg", 1);
then I drag this movieclip to the stage of the website, but whenever I preview the site, the image DOES appear (so it works there), but the problem is that it appears in the upper left, no matter where I drag the movieclip onto stage. I've also tried messing with the _x position and _y but I got nothing from that. I have the image named "image.jpg" so that when I wanna replace the picture displayed on the page I can just drag another image file called "image.jpg" to overwrite the previous one.
Any help would be greatly appreciated, I've been racking my brain over this for the past day, meanwhile its probably just something stupid and simple that I need to do . Thanks in advance.
|