AttachMovie problem
I have a main clip with a gallery-style movie clip in it that has recently been required to be updated with new content (basically means adding new galleries). On the main timeline there is a whole whack of code controlling the functionality of the original gallery. I figured that I'd use attachMovie for the new galleries and use the same instance names to save re-writing all the code. The new galleries reside in their own folders in the library and have their linkage set as Project1 throught Project7. attachMovie is working but now none of the nested clips within the attached clip work that contain onRollover/onRollOut/onPress events. I've traced their relevent instance names and they are there within the attached clip.
Here's the idea:
ProjectsMenu.Project1.onPress = function(){
removeMovieClip(PicsAll);
//PicsAll is the original gallery on stage at depth -16383
attachMovie("Project1", "PicsAll", -16383, {_x:474, _y:172});
Also, I realise removeMovieClip(PicsAll) is probably redundant since I'm attaching the new clip at the same depth as original.
Hi Kglad,
No mouse handlers assigned directly to PicsAll however I am assigning mouse handlers to nested clips. For example:
PicsAll.PicsClip.MiniButsClip.Mini1Clip.onRollOver = function () {
All of these are now dead in the water and yet are tracable.
Similar Messages
-
I have a bit of an odd problem with attachMovie.
In my library I have several movies all build up in pretty much the same way.
They are a couple of frames long with a different image on each frame.
They have a color layer at 70% as sort of an overlay.
And on top of that a layer with a movieclip to serve as a mask for the overlay.
On the stage I have a movieclip named holder to attach them to and a couple of buttons to do that.
The buttons execute the following function:
resetVideo = function (idname, flvname) {
my_video.clear();
navholder.attachMovie(idname,"navigatie",1);
my_video.attachVideo(stream_ns);
stream_ns.play("FLV/"+flvname+".flv");
trace("check")
This loads a movie into the my_video object and attaches one of the movieclips to the navholder.
So far everything works fine. The video loads and the movieclips get replaced every time.
But now comes the weird part.
I'm animating the movieclips based on data that is received from cuepoints in the loaded movie and the script for that looks like this:
stream_ns.onCuePoint = function(infoObject:Object) {
if (infoObject.parameters != undefined)
navholder.navigatie.gotoAndStop(infoObject.parameters.navs_Slider);
navholder.navigatie.navmask._xscale =navholder.navigatie.navmask._yscale=parseFloat(infoObject.parameters.maskscale_Slider)*n avscale;
navholder.navigatie.navmask._x = parseFloat(infoObject.parameters.maskposx_Slider)*navscale;
navholder.navigatie.navmask._y = parseFloat(infoObject.parameters.maskposy_Slider)*navscale;
The thing that happens now is that the gotoAndStop part works fine and the clip goes nicely through the frames but the animation of the mask doesn't work at all. I've checked the naming several times and when I place the clip directly on the stage the mask animation works fine. So somehow when I use the attachMovie command the link to the navmask instance gets either lost or it's not possible to animate it at all in an attached movieclip.
If anyone could shed some light on this it would be highly appriciated.
Grtz,
TaoHunterSigh... Problem solved:
For the navscale in the formula
navholder.navigatie.navmask._x = parseFloat(infoObject.parameters.maskposx_Slider)*navscale;
I used the width of the navigatie object and I hadn't changed that one to navholder.navigatie._width so therefore the values all came back as NaN :/ -
Problems w/ race conditions when using attachmovie
Hello,
I'm having a strange problem w/ race conditions when using attachmovie.
I have a class linked to a movie clip that I'm attaching to the stage. The class is
fired off when the movie clip is attached but also other classes are getting loaded at the same time
while the movie clips is attached. Even though the other classes are called after the
movieclip is attached, they are getting loaded faster and therefor the class linked to the attached movie clip
cannot access their functions.
I'm looking for a listener that will fire off an event ONLY when the attached movieclip is fully loaded but I can't
seem to find any examples of associating a listener to a attachmovie method.
Any ideas?
Thanks,
Clem Cflash is single threaded so nothing happens simultaneously. what do you mean by, "other classes are getting loaded at the same timewhile the movie clips is attached"
-
Problems with an array (attachMovie)
I've created a 20 x 20 grid of objects (openCircles). They're set to 'alpha = 0', then 'alpha = 100' on rollover. This works for all of them except for the final one at the coordinate T,20 in the bottom right corner, as I'm not able to rollover over it. To test whether or not they all existed, I set them all to an initial value of 'alpha = 100' and they did all appear, but I'm still unable to rollover the one at T20.
The other problem is that when an 'openCircle' is clicked, a 'filledCircle' (set up as another grid of invisible objects in the same place) is supposed to appear in its place. That doesn't happen. All of the objects are created and exist, using attachMovie, so it's maybe due to some logical error. See code:-
I'd be grateful for any help. Many thanks.
stop();
//The purpose of this experiment is to locate a trap of oil. Only 30 exploration holes are allowed.
//Use the grid coordinate to locate the borehole and then plot the depth
//Drilled is set to false in the 1st(previous) frame
//Rolling over a grid coordinate will reveal a borehole (open circle).
//Click on the borehole (open circle) to start drilling
//open circle will be removed
//drilled is set to true for that coordinate
//filled circle will appear in its place
//set up variables for grid array of open circles (undrilled) and closed circles (drilled)
var spacing:Number = 5.75;
var cols:Number = 20; // number of columns in grid
var rows:Number = 20; // number of rows in grid
var leftMargin:Number = 154;
var topMargin:Number = 169;
var currentRow:Number = 0;
var currentCol:Number = 0;
for (i=1; i<=rows; i++) {
for (j=1; j<=cols; j++) {
current = attachMovie("openCircle_mc", "openCircle_mc"+i+"_"+j,getNextHighestDepth());
current._x = leftMargin + ((i-1) * (spacing + current._width));
current._y = topMargin + ((j-1) * (spacing + current._height));
current2 = attachMovie("filledCircle_mc", "filledCircle_mc"+i+"_"+j, getNextHighestDepth());
current2._x = leftMargin + ((i-1) * (spacing + current2._width));
current2._y = topMargin + ((j-1) * (spacing + current2._height));
//open circle initially invisible, then visible on rollOver
current._alpha = 0;
//filled circles initially invisible
currentCol2=(current2._x-leftMargin)/(spacing + current2._width);
currentRow2=(current2._y-topMargin)/(spacing + current2._height);
if (drilled[currentCol,currentRow]==true){
current2._alpha = 100;
}else{
current2._alpha=0;
//open circle visible on rollover
current.onRollOver = function() {
this._alpha = 100;
currentCol=(this._x-leftMargin)/(spacing + current._width);
trace("current column ="+currentCol);
currentRow=(this._y-topMargin)/(spacing + current._height);
trace("current row ="+currentRow);
if (drilled[currentCol,currentRow]==false){
trace("Click on the grid point to drill at "+rowLabel[currentRow]+","+colLabel[currentCol]);
}else{
trace("Click on the grid point to review the core at "+rowLabel[currentRow]+","+colLabel[currentCol]);
} //end 'if-else'
//open circle invisible on rollout
current.onRollOut = function() {
this._alpha = 0;
trace("No grid point selected")
//click on open circle - variable drilled becomes true
current.onRelease=function(){
drilled[currentCol,currentRow]=true;
trace(drilled[currentCol,currentRow]);
this.removeMovieClip();
This is an image of the grid showing an 'openCircle' visible when rolled overThanks for the explanation. That was very helpful.
However, I am having problems with the variables. I did as you suggested though and extended the (grid) layer, but had to create a separate keyframe for the code layer, as that code had to execute first before moving into the next frame. See below (I've also attached the fla, but if you need any more information, please let me know):
In frame 2 of the animation, if an open circle mc is clicked, that mc is deactivated (removed), drilled becomes true for that coordinate, a filled circle becomes visible in its place and you enter another frame(3) (this is currently just a test frame), to later be used to implement the drilling animation for a clicked coordinate.
It all seems to be working as it should, until the open circle is clicked and you enter frame 3. See below:
All the instances of the openCircle mc's are still active in frame 3, so I guess I need to use removeMovieClip(). I know how to do that for a single instance, but howdo I execute that if they're in an array?
I also don't want any instances of the filledCircles from frame 2 to be visible in frame 3. I'm not sure how to hide them temporarily in frame 3 and then have them visible again in frame 2?
When I go back to frame 2 (using a back button), all of the filled circles in the array are visible, whereas only the ones that have been previously clicked (drilled = true) should be visible. However, when I return to frame 2 and do a trace to find out which coordinates are set to true/false, it seems that a whole row is now set to (drilled = true), whereas it should just be a single coordinate set to true. Oddly enough, the variable seems to working properly in frame 2 when the code is first executed, but then when I go to frame 3 and then re enter frame 2, it's not working as it should do. Below is the trace code that I've used:
if (drilled[currentCol,currentRow] == false) {
trace("Click on the grid point to drill at " + rowLabel[currentRow] + "," + colLabel[currentCol]);
} else {
trace("Click on the grid point to review the core at " + rowLabel[currentRow] + "," + colLabel[currentCol]);
If you could help, I'd be very grateful! Very many thanks.
http://synergese.co.uk/boreholes15.fla
Message was edited by: Pippa01
Sorry, Although the original question was correct, I've just unmarked it as correct. Maybe, I should have started it as a new thread? -
.onPress problem after .attachMovie
Hello, I'd appreciate some direction with this. Here's the
code found within one MC acting like a button:
it all works great except that the movieClip which is
attached refused to respond to the .onPress event. NOTE: that it
works perfectly as it should if I take the code that brings in the
MC and put instead into the root of the file. But it gets weird
when done from within the button.
stop();
this.buttText.textColor = 0xFFFFFF;
this.buttText.text = "HOME";
var c1 = 0;
this.onRollOver = function() {
buttText.textColor = 0x0000FF;
myRows1 = 4;
myCols1 = 3;
for (var aa = 0; aa < myCols1; aa++) {
for (var a = 0; a<myRows1; a++) {
var myClip = this.attachMovie("myButtsMain", "myButtsMain" +
c1, c1++);
myClip._y = myClip._height*a+myClip._height;
myClip._x = myClip._width*aa;
myClip.onPress = function() {
this.onRollOut = function() {
for (var aaa = 0; aaa < myRows1 * myCols1 + 1; aaa ++) {
removeMovieClip("myButtsMain" + aaa);
I'd appreciate any help with this. Thanks in advance.Yes,
btw, I understood how I shouldn't be putting actionscript
inside objects and had moved it to the main timeline's 1st Frame
after making proper adjustments to code, but of course that didn't
help either.
Anyhow, someone elsewhere explained to me how one can't have
any nested rollovers in Flash. Well, least not controlled through
actionscript. Also, this person was kind enough to provide a good
link which I'm looking up right now.
thanks MotionMaker btw for responding, :-) -
I have a movieClip that is a rounded rectangle, with 9-scale
slicing turned on, and a linkage of "border" in my library, set to
export in first frame.
I am attempting to place this as a background behind a
code-created text field.
My code is as follows.
The text appears, correctly formatted, but the movieClip does
not appear. If I call a trace to the _width or _height property of
the movieClip, they come out as 0.dzedward
I am not attaching to the newBord movieClip - I am setting up
newBord as a reference to the attached movie. This is standard
operating procedure, and I have done it countless times. Using the
depth as part of the instance name is a way of guaranteeing a
unique instance. I will be placing an unknown number of these clips
this way in the finished project, I have just run into a snag here.
And yes, I did define nHD earlier (note that I only use the
variable declaration once) - but I am setting it to a new value, as
I already used it for the text box. -
AttachMovie is shown on debugger but not on play
I'm using the tutorial XML photo gallery with thumbnail from http://www.kirupa.com/developer/mx2004/thumbnails.htm
I'v added code to deal when the image is not aviliable I attach a symbol with Text instead to the thumbnail and to the photo as well
the problem is when I have an image as photo and I press a symbol thumbnail it dosent attach the symbol instead of the Image.
it doesnt work at all.
my solution for that was to unloadMovie and it solved partly
thumbNail onRelease activation
target_mc.onRelease = function() {
if (!isdef[p] && isdef[this.pictureValue]) {
//if the old MC is image and the wanted new MC is a symbol
picture.unloadMovie();
p = this.pictureValue-1;
nextImage();
The nextimage function does the load of the picture or attachMovie for the symbol
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
if (isdef[p]) { //use defualt symbol instead of a photo
picture.attachMovie("mcDef", "mcDef"+p, 1000);
picture["mcDef"+p].m_text.text = reverseString(description[p]);
picture["mcDef"+p].ref_text.text = reverseString(description[p]);
} else {
picture.loadMovie(image[p], 1);
picture.pictureValue = p;
desc_txt.text = description[p];
picture_num();
Nothing is show and no instance was made of the symbol and when pressing again on symbol thumbnail it then works and all is well
BUT on debugging it does work on the first time and I dont have to press twice on the symbol!
it probably caused that there was no load when attaching so veriables loaded and filesize has no maning in the logice .
doing unload is a work around the problem does any body has an idea how to deal with this ether with the unload or better off without.
i'v attached the fla file so you can see the code
10Xthe alpha is returen to 100% late on in a loop:
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
I'v printed out the alpha and on every click on thumbnail it increments by 10 untill more then 100% thats OK
this ia the print out of list veriables:
1. the image is selected
Movie Clip: Target="_level0.picture"
Variable _level0.picture.onRelease = [function 'onRelease']
2.pressing on symbol thumbnail clears the screen after unloading the image but symbol doesn show and picture._alpha=107.999
Movie Clip: Target="_level0.picture"
Variable _level0.picture.onRelease = [function 'onRelease']
3.pressing on the thumbnail of the symbol the second time and it shows
Movie Clip: Target="_level0.picture"
Variable _level0.picture.onRelease = [function 'onRelease']
Variable _level0.picture.pictureValue = 2
Movie Clip: Target="_level0.picture.mcDef2"
Edit Text: Target="_level0.picture.mcDef2.m_text"
variable = null,
text = "ןיינב",
htmlText = "ןיינב",
html = false, textWidth = 114, textHeight = 73, maxChars = null, etc...........
so it looks like that it didn't load the symbol on the first click even though it goes through the code that attachMovie()????
But if I run this in debbug mode codeline by codeline it loads the symbol and shows it on the first tril.
here is the printout of the run test mode:
picture.loadMovie(image[p]); <== loading the image after clicking the image thumbnail
picture._alpha=0
picture._alpha=9.765625
picture._alpha=19.53125
picture._alpha=29.296875
picture._alpha=39.0625
picture._alpha=48.828125
picture._alpha=58.59375
picture._alpha=68.359375
picture._alpha=78.125
picture._alpha=87.890625
picture._alpha=97.65625
picture._alpha=107.421875
picture.attachMovie('mcDef', 'mcDef'+p, this.getNextHighestDepth()); <== performing the code but no symbol shows and on list veriabls it shows there is no symbol attached!!!!!!!!!!!!!!!!!
picture._alpha=0
picture._alpha=9.765625
picture._alpha=19.53125
picture._alpha=29.296875
picture._alpha=39.0625
picture._alpha=48.828125
picture._alpha=58.59375
picture._alpha=68.359375
picture._alpha=78.125
picture._alpha=87.890625
picture._alpha=97.65625
picture._alpha=107.421875
picture.attachMovie('mcDef', 'mcDef'+p, this.getNextHighestDepth()); <== pressing the second time the symbol is attached and shows
picture._alpha=0
picture._alpha=9.765625
picture._alpha=19.53125
picture._alpha=29.296875
picture._alpha=39.0625
picture._alpha=48.828125
picture._alpha=58.59375
picture._alpha=68.359375
picture._alpha=78.125
picture._alpha=87.890625
picture._alpha=97.65625
picture._alpha=107.421875
on debugger mode it attache's the symbol to the movie on the first click!!! and no problem
why isnt it doing the attachMovie after unloadMovie??????
the unloadMove is performed right after clicking the thumbnail before sending to function that does the loadMovie or attachMovie
I tried updateAfterEvent(); after unloadMovie() and it didnt help!!
running on MX2004
10X -
How I remove previous MC created with createmovieClip() and attachMovie()
Hello.
i have another problem today, :-)
my little application contain a combobox and a MC "filmstrip" in my _root. the combobox work with an xml file containing links to other xml files. Inside my MC "filmstrip" i have a script loading with a for loop the xml file selected in the combobox on the _root .
In this loop i createEmptyMovieClip an attachMovies with the data of the xml selected.
evrything works exept that evrytime i change my selection in the combobox it load the data on top of the previous load.
I would like to delete the previous load before load the new one... if someone can help me???
On my scene 1st frame i have only a code for scroll the movieclip filmstrip but i think is not nescessary that i show it.
here is the code inside the MC fimlstrip (sorry but i put all the code). i attach an example aswell
var link1:Array = new Array();
var url:String;
var theUrl:String;
var whoOn:Number;
whoOn = 1;
//load the xml containing the link for T.Load() function
var x:XML = new XML();
x.ignoreWhite = true;
x.onLoad = function(success) {
var photos:Array = this.firstChild.childNodes;
for (i=0; i<photos.length; i++) {
link1.push(photos[i].attributes.link1);
url = link1[whoOn];
theUrl = url;
_root.filmstrip.Tload(theUrl);
_root.lengthscroll(theUrl);
x.load("category.xml");
//create the Listener object
var cbListener:Object = new Object();
//create tee change function
cbListener.change = function(event_obj:Object) {
if (_root.select.selectedItem.label == "Last updated") {
whoOn = 0;
} else if (_root.select.selectedItem.label == "Special") {
whoOn = 1;
trace(_root.select.selectedItem.label);
url = link1[whoOn];
trace("url is "+_root.filmstrip.url);
theUrl = url;
_root.lengthscroll(theUrl);
Tload(theUrl);// set the url to load in the T.load()
_root.select.addEventListener("change",cbListener);
function Tload(theUrl) {//function that load the url selected in the combobox
var T:XML = new XML();
T.ignoreWhite = true;
var thumb:Array = new Array();//create array
var thTxt:Array = new Array();
var DescTXT:Array = new Array();
var priceTXT:Array = new Array();
var linkTXT:Array = new Array();
var Modelink = "http://www.windi.no/catalog/advanced_search_result.php?keywords=";//1st part of the link for when you click on the tumbnails
var Spc = 0;// space between thumbnail default 0
var posX = 0;// thumbnail position x
var posY = 0;//thumbnail 1st position y
var tl:MovieClip = this;
var whoIsOn:Number;
whoIsOn = 0;
T.onLoad = function(xml) {
var photos:Array = this.firstChild.childNodes;
//loop the php Xml for the thumbnail
for (i=0; i<photos.length; i++) {
var Num = i+1;
var WhoIsOn = Num;
var TXTCLIP = "TXTCLIP"+Num;
var TXTCLIP2 = "TXTCLIP2"+Num;
var TXTCLIP3 = "TXTCLIP3"+Num;
var Clp_name = "clip"+Num;
var Bt_name = "Bt"+Num;
var container = (container+Num);
//put each attributs of thumbnail for each photos node
thTxt.push(photos[i].attributes.thumbtext);
thumb.push(photos[i].attributes.thumbnail);
DescTXT.push(photos[i].attributes.thumbdesc);
priceTXT.push(photos[i].attributes.thumbprice);
linkTXT.push(photos[i].attributes.thumbmodel);
_root.Text_Thumbnail(thTxt[whoIsOn]);
_root.bigphotos.loadMovie(thumb[whoIsOn],1);
var fullink = (Modelink+linkTXT[i]);//the 2nd part of the "Modelink"
//display Tiles
var TXT:MovieClip = tl.attachMovie("TXTCLIP", TXTCLIP, tl.getNextHighestDepth());
TXT._x = posX+120;
TXT._y = posY+Spc+13;
TXT.titleTXT.text = thTxt[i];
//desccription
var TXT2:MovieClip = tl.attachMovie("TXTCLIP2", TXTCLIP2, tl.getNextHighestDepth());
TXT2._x = posX+120;
TXT2._y = posY+Spc+30;
TXT2.titleTXT.text = DescTXT[i];
// display prices
var TXT3:MovieClip = tl.attachMovie("TXTCLIP3", TXTCLIP3, tl.getNextHighestDepth());
TXT3._x = posX+120;
TXT3._y = posY+Spc+90;
TXT3.titleTXT.text = priceTXT[i];
//display thumbnails
var container:MovieClip = tl.createEmptyMovieClip(Clp_name, tl.getNextHighestDepth());
container.loadMovie(thumb[i],1);
container._yscale = 30;
container._xscale = 30;
container._x = posX;
container._y = posY+Spc;
//for the OnRelease function on the thumbnail
var BT:MovieClip = tl.attachMovie("Btb", Bt_name, tl.getNextHighestDepth());
BT._x = posX;
BT._y = posY+Spc;
BT.whoIsOn = i;
BT.onRelease = function() {
stopAllSounds();
getURL((Modelink+linkTXT[this.whoIsOn]));//this is the link when you click on the thumbnail
BT.onRollOver = function() {
_root.Text_Thumbnail(thTxt[this.whoIsOn]);//display the title of the thumbnail by rolling over
_root.whoIsOn = this.whoIsOn;
_root.bigphotos.loadMovie(thumb[this.whoIsOn],1);//Display the poto of the thumbnail by rolling over
BT.onRollOut = function() {
_root.Text_Thumbnail("");
Spc = Spc+160;//for the space betwen the clips
//load the xml file selected in the combobox
trace("the url loaded is: "+theUrl);
T.load(theUrl);//Load the url selected in the comboboxcreated a function for remove the movieClips bu it dont wotk :
var link1:Array = new Array();
var url:String;
var theUrl:String;
var whoOn:Number;
whoOn = 1;
//HERE MY FUNCTION
function reset_all() {
_root.filmstrip.removeMovieClip();
//<---TO HERE
//load the xml containing the link for T.Load() function in filmstrip movie clip the xml file
function loadCat() {
var x:XML = new XML();
x.ignoreWhite = true;
x.onLoad = function(success) {
var photos:Array = this.firstChild.childNodes;
for (i=0; i<photos.length; i++) {
link1.push(photos[i].attributes.link1);
url = link1[whoOn];
theUrl = url;
_root.filmstrip.Tload(theUrl);
_root.lengthscroll(theUrl);
x.load("category.xml");
loadCat();
//create the Listener object
var cbListener:Object = new Object();
//create tee change function
cbListener.change = function(event_obj:Object) {
if (_root.select.selectedItem.label == "Last updated") {
whoOn = 0;
} else if (_root.select.selectedItem.label == "Special") {
whoOn = 1;
trace(_root.select.selectedItem.label);
url = link1[whoOn];
trace("url is "+_root.filmstrip.url);
theUrl = _root.filmstrip.url;
_root.lengthscroll(theUrl);
Tload(theUrl);// set the url to load in the T.load() function in filmstrip
_root.select.addEventListener("change",cbListener);
function Tload(theUrl) {//function that load the url selected in the combobox
var T:XML = new XML();
T.ignoreWhite = true;
var thumb:Array = new Array();//create array
var thTxt:Array = new Array();
var DescTXT:Array = new Array();
var priceTXT:Array = new Array();
var linkTXT:Array = new Array();
var Modelink = "http://www.windi.no/catalog/advanced_search_result.php?keywords=";//1st part of the link for when you click on the tumbnails
var Spc = 0;// space between thumbnail default 0
var posX = 0;// thumbnail position x
var posY = 0;//thumbnail 1st position y
var tl:MovieClip = this;
var whoIsOn:Number;
whoIsOn = 0;
T.onLoad = function(xml) {
reset_all(); /// HERE I APLY IT
var photos:Array = this.firstChild.childNodes;
//loop the php Xml for the thumbnail
for (i=0; i<photos.length; i++) {
var Num = i+1;
var WhoIsOn = Num;
var TXTCLIP = "TXTCLIP"+Num;
var TXTCLIP2 = "TXTCLIP2"+Num;
var TXTCLIP3 = "TXTCLIP3"+Num;
var Clp_name = "clip"+Num;
var Bt_name = "Bt"+Num;
var container = (container+Num);
//put each attributs of thumbnail for each photos node
thTxt.push(photos[i].attributes.thumbtext);
thumb.push(photos[i].attributes.thumbnail);
DescTXT.push(photos[i].attributes.thumbdesc);
priceTXT.push(photos[i].attributes.thumbprice);
linkTXT.push(photos[i].attributes.thumbmodel);
_root.Text_Thumbnail(thTxt[whoIsOn]);
_root.bigphotos.loadMovie(thumb[whoIsOn],1);
var fullink = (Modelink+linkTXT[i]);//the 2nd part of the "Modelink"
//display Tiles
var TXT:MovieClip = tl.attachMovie("TXTCLIP", TXTCLIP, tl.getNextHighestDepth());
TXT._x = posX+120;
TXT._y = posY+Spc+13;
TXT.titleTXT.text = thTxt[i];
//desccription
var TXT2:MovieClip = tl.attachMovie("TXTCLIP2", TXTCLIP2, tl.getNextHighestDepth());
TXT2._x = posX+120;
TXT2._y = posY+Spc+30;
TXT2.titleTXT.text = DescTXT[i];
// display prices
var TXT3:MovieClip = tl.attachMovie("TXTCLIP3", TXTCLIP3, tl.getNextHighestDepth());
TXT3._x = posX+120;
TXT3._y = posY+Spc+90;
TXT3.titleTXT.text = priceTXT[i];
//display thumbnails
var container:MovieClip = tl.createEmptyMovieClip(Clp_name, tl.getNextHighestDepth());
container.loadMovie(thumb[i],1);
container._yscale = 30;
container._xscale = 30;
container._x = posX;
container._y = posY+Spc;
//for the OnRelease function on the thumbnail
var BT:MovieClip = tl.attachMovie("Btb", Bt_name, tl.getNextHighestDepth());
BT._x = posX;
BT._y = posY+Spc;
BT.whoIsOn = i;
BT.onRelease = function() {
stopAllSounds();
getURL((Modelink+linkTXT[this.whoIsOn]));//this is the link when you click on the thumbnail
BT.onRollOver = function() {
_root.Text_Thumbnail(thTxt[this.whoIsOn]);//display the title of the thumbnail by rolling over
_root.whoIsOn = this.whoIsOn;
_root.bigphotos.loadMovie(thumb[this.whoIsOn],1);//Display the poto of the thumbnail by rolling over
BT.onRollOut = function() {
_root.Text_Thumbnail("");
Spc = Spc+160;//for the space betwen the clips
//load the xml file selected in the combobox
trace("the url loaded is: "+theUrl);
T.load(theUrl);//Load the url selected in the combobox -
Action script _root.attachMovie
Hi all! I have a big problem at work. Here is the situation. I have an html passing a variable as an array to my flash. In the flash i want to call a couple of symbols depending on the variable from html and display them as a slideshow. I need to add these symbols dynamically but i dont know where to start. I have created all my movie symbols and linked them for actionscript. I have created a simple line of code just to display one symbol using _root.attachMovie and the symbol does not show. here it the code:
_root.attachMovie(usb, usb,1);
usb.x = 276.15;
usb.y = 199.50;
Now the symbol should be visible right? What am i doing wrong?I will paste my code so you have better understanding. Here is what i have in my flash:
txt1.text = logos;
It seems I have difficulties passing the FlashVars from html. I have created a dynamic text box which I gave the instance name txt1. In my html, I have the following code for the flash:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="60" id="FlashID" title="logoflash">
<param name="movie" value="logo.swf" />
<param name=FlashVars value="logos=usb%2mp3" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="logo.swf" width="300" height="60">
<!--<![endif]-->
<param name=FlashVars value="logos=usb%2mp3" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
</object>
</object>
I have already wrote "fla" in the text box. When I preview the flash only all that shows is "f". When I preview the html within Dreamweaver, there is nothing on the text box.
When i try your code:
trace(usb);
var mc:MovieClip=_root.attachMovie(usb, usb,1);
trace(mc);
Nothing shows...I have worked with that 4 hours yesterday and read everything, I`m lost!!! -
OK here is my function
This works to produce a simple text effect. The problem
arises when I try to use it multiple times. The variable "theText"
either is written twice (I only get one string twice on the screen)
or the two get mixed together( half of on "theText" and part of the
last function calls "theText". I need to be able to use the effect
more than once throughout a linear animation. Can anyone please
help solve this. I have a deadline and I am obviously out of my
league.
speed = 50;
i=1;
function newText1(theText,space,initX,initY) {
if(i<theText.length+1) {
thisLetter = theText.substring(i-1,i);
textMovies = attachMovie("textBox","textBox"+i,i);
textMovies._x = textMovies._x + initX
textMovies._x = textMovies._x + initX +(space * i);
textMovies._y = initY;
textMovies.theText = thisLetter;
++i;
} else {
trace("Interval Cleared");
clearInterval(intevalID);
intevalID = setInterval(newText1,speed,"test?",12,5,60);It's simple but confusing. The default path on your local
machine (while testing) starts from the directory the .SWF file is
in.
The default path on the server starts from the directory the
.HTML file is in.
If you keep HTML and SWF in the same directory, you don't
need to worry. Otherwise you need to take care.
Good luck
Wolf -
SetInterval and XML Load Problem
Hello,
I 'm having the simple problem of making sure the XML is
loaded before beginning the Interval sequence. Therefore it is
missing some of the XML data when loading. See example:
http://alt.coxnewsweb.com/statesman/img/advertising/_jacob/Site1/products.html
I tried a success boolean with the XML onLoad Handler, but my
setInterval stopped working. I could easily just not know how to
properly implement XML onLoad.
Can someone help me out with properly loading the XML
document before the setInterval is initiated.
Thank You - Jacob
Here is the Working Code of the example given...
//New XML Object
var mydata:XML = new XML();
//ignores formatting of XML files tabs, returns, ect.
mydata.ignoreWhite = true;
//Setup onLoad Function
mydata.onLoad = loadXML;
//Loads actual XML Data File
mydata.load("data.xml");
//setInerval Vars
var intervalId:Number;
var count:Number = 1;
var maxCount:Number = 20;
var duration:Number = 100;
//Thumbnail Position Vars
var originalx:Number = 20;
var originaly:Number = 55;
currentx = originalx;
currenty = originaly;
var i:Number = 0;
//Create Thumbnails Interval
function thumbInterval():Void {
//trace(i);
//Controls # of Thumbnails per line
if ((i % 5 == 0) && (i > 0)) {
currenty += 125;
currentx=originalx;
//Attatch Library MC
_root.attachMovie("thumbnailMC", "thumbnailMC" + i, 1000 +
i);
//Load Image, text, and position
_root["thumbnailMC" + i].thumbnailname =
mydata.firstChild.childNodes
.childNodes[0].firstChild.nodeValue;
_root["thumbnailMC" + i].textbox.productdescr =
mydata.firstChild.childNodes.childNodes[1].firstChild.nodeValue;
_root["thumbnailMC" + i]._x = currentx;
_root["thumbnailMC" + i]._y = currenty;
currentx += 130;
i++
if(count >= maxCount) {
clearInterval(intervalId);
count++;
intervalId = setInterval(this, "thumbInterval",
duration);Please use the attach code option to post your code. bracket
i bracket is seen as italic by this forum.
And where is the loadXML function?
The xml is loaded when the onLoad event gets fired. Your
loadXML() is the place where you want to call a function that
initiates the interval. -
Hi all,
By refering flash remoting variable declaration documents, it
says we can have a variable with $ and _ as a part of the variable.
i am using Flash Media server2, And PHP (version5.0.5); for
remoting.
when ever i used variable name with _ creates problem and
shows "" value;
Following is a sample code,
var myLoader = new LoadVars();
myLoader.user_id = "1";
myLoader.onLoaded = function(){
myLoader.sendAndLoad("myPhpPath",myLoader,"POST");
// this code creates problem(but its running in flash but not
in Mediaserver).
if i remove the _ symbol, it works fine,
Does anyone know why it happensYou can pass an init object as the 4th argument to load
movie.
Basically this takes the form of braces encapsulating a comma
seperated list of property_name colon property_value
eg {_x: xpos, _y:ypos}
_root.attachMovie(_global.cl_Name, _global.cl_Name,
_global.clipHeight++, {
_x: xValue,
_y: yValue
Happy Flashing -
AttachMovie adds library item twice?
Hi everyone!
I've come across this problem for the second time now, and
I'm still not sure what solved it the first time.
I have a timeline that contains the clip "contentMC". On the
same timeline the following AS appears:
_root.contentMC.attachMovie("home", "contentHolder",
_root.contentMC.getNextHighestDepth());
The library item "home" contains several text objects. The
strange thing is that, while the item is added as "contentHolder",
the contents of "home" is also added to "contentMC". So when I use
List Objects during preview, I get:
Level #0: Frame=24 Label="Interface Build"
Movie Clip: Frame=1 Target="_level0.contentMC"
Shape:
Text:
Text:
Text:
Text:
Text:
Text:
Text:
Text:
Movie Clip: Frame=1 Target="_level0.contentMC.contentHolder"
Shape:
Text:
Text:
Text:
Text:
Text:
Text:
Text:
Text:
The first row of "Text:" shouldn't be there.
I came across this problem before at a different level. That
one was solved (I think) by replacing .getNextHighestDepth() with
1. This time, however, that doesn't help.
Anyone any ideas?
I've uploaded the .fla at:
http://www.eurovoice.nl/flash/eurovoice01.fla
Thanks in advance!
Yours,
AndraI guess I got lost in my own plans for navigation! I
completely forgot that the "contentMC" on the timeline was an
instance of "home". This caused the textfields to appear there.
I've swapped the instance of "home" with an empty movieclip. That
solved the problem.
Thanks kglad, for putting me on the right track.
Devendran: I haven't had trouble attaching the "homeDiensten"
to "home" yet, but I'll run a few online tests and keep an eye out
for that possible problem. I do use a preloader at the very
beginning of the movie, so all MC's I want to attach should be
available without delay.
If I were to safeguard for this problem, should I do it like
this?:
_root.contentMC.contentHolder.onLoad = function(){
_root.contentMC.contentHolder.attachMovie("homeDiensten",
"contentSub", 1);
Thanks for your help!
Yours,
Andra -
Can't add content to ScrollPane immediatly after attachMovie
Hello,
I've successfully attached a clip (identifier = "myPane_mc") which contains a ScrollPane (instance name = "myPane_sp") to the main Timeline from the Library. No problem.
attachMovie("myPane_mc","myPane_mc_01",getNextHighestDepth());
However, I can't immediatley load another clip (identifier = "myPic_mc") into the ScrollPane.
attachMovie("myPane_mc","myPane_mc_01",getNextHighestDepth());
myPane_mc_01.myPane_sp.contentPath = "myPic_mc";
Is this particular to the ScrollPane component? It works fine if I place the contentPath code in the next frame of the Timeline, but is there a function that I can attach to myPane_mc_01 to load myPane_sp's content without the additional frame?
Thanks!It can take a little time for components to come into existence when they are added dynamically, so one way to get around this with code is to put a slight delay in before the command is executed using the setTimeout functtion... Try...
attachMovie("myPane_mc","myPane_mc_01",getNextHighestDepth());
var sto = setTimeout(setContent, 100); // 100 msec
function setContent(){
myPane_mc_01.myPane_sp.contentPath = "myPic_mc"; -
Hi, I don't know if anyone else has had this problem, but i
can't seem to solve it.
so i have a .fla and i'm loading an external swf into a
movieclip that exisits on the first frame of the .fla file using
movieClip.loadMovie. I want to attach a movieclip from the library
of the .fla i'm working in to the movieClip that i'm loading the
external swf into using movieClip.attachMovie. so the movieclip
should appear on top of the external swf. is this possible?Ah, thank you, that make sense now. The solution you
suggested worked great.
I did also find two other solutions, for anyone else who
might read this. One is to essentially create an empty movieclip on
your timeline. From the linkage window for the empty movieclip, I
made sure I set the Class field to the name of the class I'd
written, something I didn't do previously. This attaches all the
class actionscript to the empty movieclip, and even automatically
runs the constructor when the empty movieclip is placed on the
timeline. It also automatically provides a 'reference' to the main
timeline when I refer to this.attachMovie() from inside the class.
So it worked, but isn't as elegant as doing everything from the
actionscript (unless you are building a component).
The last reference I came across is the
Object.registerClass() method used to attach as class to an object,
similar to using the Linkage method above. But I haven't
successfully tried it yet.
Thanks again for the help kglad,
dana.
Dana Sheikholeslami
Art Institute of California
Maybe you are looking for
-
When trying to update phone, a message says i have purchased items that have not been transferred to iTunes, what is this?
-
User Defined Field migration with long predelined list in DTW
Hi Expert, The project is using 2007A PL30. Due to mapping to customer existing legacy system, there are UDF with a set of predefined value so that user can select from drop down list. The list is very long and description is more than 30 characters
-
Junk characters in the purchase order fax received from the fax machine
Dear Experts, I am facing the following issue. I am sending the PO form to a fax number from ME22N using the FAX medium. The PO form is designed by sapscript. I am getting the fax too from the fax machine. But it is not in the format designed by saps
-
Access Portal Parameter from within ABAP-Web Dynpro
Hi all, I have an ABAP Web Dynpro which is executed via an Web Dynpro iView in Enterprise Portal. How can I read the UserID of the portal user within the web dynpro? (the portal user will not be the user who called the Web Dynpro) Any suggestions on
-
Diff. between DOCTYPE and ROOT in xml
Hi , what is differnce betwwen Doctype and root elemnt. Because we can have many doctype and only one root. Somebody says both are same. Is it true? If yes then, what about above statement? Whats exact truth? ....yogesh