473,749 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Load image in a movieclip inside two movieclips

sumaiya
43 New Member
I know how to load dynamic images in a movieclip
sPhoto.loadMovi e('http://localhost/1.jpg');

I have two movieclips "mcMain" and "mcArticle"

mcMain ---- mcArticle --- mcPhoto

mcPhoto is inside mcArticle and is suppose load an image dynamicaly I am using the above code but it does not work. Please Help. My code is given below

onClipEvent(loa d) {
// create Text format properties
var myFormat:TextFo rmat = new TextFormat();
myFormat.font = "Verdana";
myFormat.size = 11;
myFormat.color = 0xffffff;
myFormat.align = "Justify";

var myFormat1:TextF ormat = new TextFormat();
myFormat1.font = "Verdana";
myFormat1.size = 11;
myFormat1.color = 0xD5D028;
myFormat1.align = "Left";
myFormat1.bold = true;

myXML = new XML();
myXML.ignoreWhi te = true;
myXML.onLoad = function(succes s) {
if (success) {
// extract XML Data
// myRecords will be an array XML records
myRecords = myXML.firstChil d.childNodes;

// Get Number of Records
totalRecords = myRecords.lengt h;
createEmptyMovi eClip("mcMain", 0); mcMain._x = -30;
mcMain._y = -10;


// loop thru each record
for (ctr = 0; ctr < totalRecords; ctr++) {

// get data from array element
var articleID = myRecords[ctr].attributes.id;
var articleTitle = myRecords[ctr].attributes.myt itle;
var articlePhoto = myRecords[ctr].attributes.pho to;
var articleText = myRecords[ctr].firstChild;


currentArticle = mcMain.createEm ptyMovieClip("m cArticle"+ctr, ctr);
currentArticle. articleID=artic leID;
if (ctr > 0) {
currentArticle. _y = mcMain["mcArticle"+(ct r-1)]._height + 10 + mcMain["mcArticle"+(ct r-1)]._y;
}


// create movieclip for Article photo
currentPhoto = mcArticle.creat eEmptyMovieClip ("mcPhoto"+c tr, ctr);
if (ctr > 0) {
currentPhoto._y = mcArticle["mcPhoto"+( ctr-1)]._height + 10 + mcArticle["mcPhoto"+( ctr-1)]._y;
}
currentPhoto.lo adMovie('http://localhost/work/photo/achieve1.jpg');




}
} else {
trace ("Problem loading XML");
}
}
myXML.load("htt p://localhost/work/achieve.php?d=" + new Date().getTime( ));

//The most important function so far
function rebuildHTML(the Text:String):St ring {
var tempText:String = theText;
var chunks:Array = new Array();

chunks = tempText.split( "&lt;")
tempText = chunks.join("<" );
chunks = tempText.split( "&gt;");
tempText = chunks.join(">" );
chunks = tempText.split( "&amp;");
tempText = chunks.join("&" );

chunks = tempText.split( "href=&quot ;");
tempText = chunks.join("hr ef=\"");
chunks = tempText.split( "&quot;>");
tempText = chunks.join("\" >");
return tempText;
}
}
Oct 24 '07 #1
2 4500
xNephilimx
213 Recognized Expert New Member
Hi sumaiya!
Where are you putting that code? It is best to put the code in a frame in the main timeline, not in a movieclip. Also in there declare a variable to point to your root, like this:

var home:MovieClip = this;

then load the xml as you did, (but, as you are in the main timeline, don't put the onClipEvent stuff), and inside it's onLoad function you can access the movieclip that you'll load the photo into as follows:

home.mcMain.mcA rticle.mcPhoto

it's really easy, and putting all the code in the main timeline you ensure all the code is there and not lost in several movieclips, making all far more tidy.

If you are creating the three movieclips dynamically you still can do this:

Expand|Select|Wrap|Line Numbers
  1. //All of this is inside the onLoad function of the XML:
  2. //create the mcMain
  3. var main:MovieClip = home.createEmptyMovieClip("mcMain", 0);
  4. main._y = -10; //you see that you can use the reference variable main to access the newly created movieclip.
  5.  
  6. //create the mcArticle, this is inside your "for":
  7. var article:MovieClip = main.createEmptyMovieClip("mcArticle"+ctr,ctr);
  8. //as you can see you can use the reference as the movieclip itself,
  9. //so main.createEmpyMovieClip is the same as
  10. //home.mcMain.createEmptyMovieClip
  11.  
  12. //I think you can get the idea from here on.
  13.  
  14.  
Best regards,
The_Nephilim
Oct 25 '07 #2
shaqa
2 New Member
How to load imageslide when i load Contact page ore any choosen page,
not to be loaded in the begin,
How to load after i press button and go to choosed page and than star imageslide.?
Oct 29 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4432
by: veenathi | last post by:
i am trying to write code for coping a certain portion of movieclip into another movieclip. for that i draw big stage movieclip. (stage_mc).Then i draw small rectangle movieclips on the stage movieclip. (rect_mc) Now what i want, is that the area of the stage_mc that the rect_mc is drawn on, should be made into another movieclip. So that portion of the stage_mc which had been selected by the rect_mc, becomes a new movieclip newMC_mc. ...
2
3743
elamberdor
by: elamberdor | last post by:
Hi All! Well, i'm modifying a dynamic map, with lat and long datapoints, my problem is it loads in text perfectly onto exact points I specify on the map, ..well now I want to load in icons(images) instead of text. (yes i'm being difficult) and i'd like the text to load into a static placeholder symbol instead. Problem is, I can get images to load in a separate file, text to load in a separate file, and text to appear in a static...
0
1941
by: shaqa | last post by:
I try to do this but i cannot. i creat two layers with actionscript seperated as slideshow need to be,,and i try to put in one rectangle all of my images but cannot put in work,it doesnt load when i go to my choosen page. Below is the script,please any one tell me how to put all of my images to one rectangle which later i can resize it,and load the image slideshow when i open choosen page. script: layer proto: MovieClip.prototype.alpha =...
1
9377
by: molle | last post by:
Hi, this is perhaps a common question, but everywhere I just find how to load external images into a movieclip. I have images in my Library that I want to load into a movieclip, so I used attachMovie like this: mc.attachMovie("imagename"); where imagename is the Linkage identifier, but this doesn't work, so I wonder what I am doing wrong?
0
2338
by: sethupnr | last post by:
hi, how can i load a gif image into a movieclip at runtime . I used loadMovie() but it only works with JPEG. thanks
1
3573
by: chromis | last post by:
Hi, This should be really simple to do and has really got me stumped. I have a movieclip inside a button, the button is called my_btn and the movieclip is called my_movie. What i want to happen is the movieclip goes to frame two when the button is rolled over, so i added this code to test the reference to the button: my_button.onRollOver = function() { trace(this.my_movie); }
0
2260
by: ralphiedee | last post by:
I have a set of movieclips on stage in a navigation area when you rollOver each button an mc appears (with buttons inside) I used attachMovieclip on each button so when you RollOver one button the mc plays and when you rollOver another it cancels the previous and displays the last mc that was rolled over. NOW The last clip rolled over is always visible on the stage and I cannot use an onRollOut function for these mc's so I need to use...
1
3646
anfetienne
by: anfetienne | last post by:
i have this code below that i made....it loads vars from txt file splits it then puts it into an array....once in an array it the brings the pics in from the array to create thumbnails and a larger image. my problem is i have captions to go with it and when i try to load the captions nothing happens or can be seen to be happening. i dont know where i am going wrong as i have no output or compiled errors var locVar = new Array();...
2
5351
by: phpuser123 | last post by:
I have my general movie clip called myscene_mc . Inside it I've placed other 2 movie clips called man_mc and insect_mc... Now,my man_mc contains another movieclip which is empty and i call it forward_mc... Now,can I use forward_mc and insect_mc to check if they are intersecting using something like that :: trace(man_mc. forward_mc.hitTest(insect_mc) I hv tried this bt althougn they are intersecting,the output is...
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.