View Full Version : I'm sure it's a bug in the Combobox
ehegyi
12-23-2004, 01:34 PM
Hi,
I'm running flash mx2004 7.2 and using the latest flash player. I've found that if you use loadmovie() when a combobox is inside the loaded swf, all swf comboboxes in the loaded fail to open.
you can easily replicate this error by:
creating a swf with a comboxbox placed on the main timeline, populate it either with actionscript or by using the properties panel. Then create another swf and place this code on frame one:
_root.createEmptyMovieClip("cboContainer", this.getNextHighestDepth());
cboContainer.loadMovie("testingComboBox1.swf");
where testingComboBox1.swf is the swf containing the combobox(s).
I've tried the loader componet, same error.
All other components seem to work fine.
This is annoying as I wish to track the loading progress with a progressbar of a swf containing comboboxes. The only way for the combobox to work is by using loadMovieNum and loading the swf into another _level. But then I can't track the swf's loading status.
Any help appreciated.
ehegyi
Hmmmm
yeh i also woud say it's a bug !!! :p
but it can by solwed :
_root.createEmptyMovieClip("a", 1);
_root.createEmptyMovieClip("b", 2);
b._x += 300;
//this is the comand you need -->
a._lockroot = true;
a.loadMovie("Test.SWF");
b.loadMovie("Test.SWF");
cancerinform
12-23-2004, 04:21 PM
This question was asked often here and lockroot does not solve the problem. Here is one thread:
http://www.actionscript.org/forums/showthread.php3?t=44860&highlight=combobox
If you search the forum under combobx you will find more threads.
ehegyi
12-23-2004, 08:01 PM
Hi Xeef, sorry your code doesn't work.
Hi cancerinform I checked out the threads and yes I've tried loadMovieNum, which does allow the combobox to work, unfortunately I can't track the loading of the swf by using a progressbar. If you know how I can load a swf using loadMovieNum and display progress of the loading swf, let me know.
Thanks
ehegyi
cancerinform
12-23-2004, 09:14 PM
I let you know tonight. I have a preloader doing that.
cancerinform
12-24-2004, 12:48 AM
Ok, here is a preloader I made for movies which have stuff exported in frame 1 but this loader can also be used as for your purpose by changing 0 to 1 in loadMovieNum. You don'r need anything because evrything is created by the loader. Just create a textfile with the following contents and name it "Comppreloader.as". Follow the instructions in the file.
/*******************************
This is the script for a simple virtual preloader to load complex movies with objects
exported in frame 1.
Parameters:
xDistance: x position of loaderbar
yDistance: y position of loaderbar
barHeight: height of the loaderbar
barColor: hexadecimal color value for the loaderbar fill
loadTarget: name of the movie to load
Create a textfile and put this script in. Save the file as "FlashscriptLoader_comp".
Create a template movie as large as the movie to preload and put this script in
frame 1 of the movie: (Example)
var myLoader:Comppreloader =
new Comppreloader(200,200,25,0xfff000,"movie.swf");
copyright: Flashscript 2004-2005
*********************************/
//class definition
class Comppreloader {
//defining all variables
//for the loaderbar
public var xDistance:Number;
public var yDistance:Number;
public var barHeight:Number;
public var barColor:Number;
//for the empty movieclips, which are created
public var loadTarget:String;
private static var emptyClip:String;
private static var movieLoader:String;
private static var outLine:String;
//for the textfields
private static var bytesField:String;
private static var frameField:String;
private static var totalField:String;
private static var loaderField:String;
//for monitoring the loading
private var perLoaded:Number;
private var loadedBytes:Number;
private var totalBytes:Number;
private var bytes:Number;
private var frame:Number;
//constructor
public function Comppreloader () {
}
public function loadTheMovie (xDistance, yDistance, barHeight, barColor, loadTarget): Void {
//passing the parameter variables
var xDist:Number = xDistance;
var yDist:Number = yDistance;
var bHeight:Number = barHeight;
var bColor:Number = barColor;
var lTarget:String = loadTarget;
//creating empty movieclips for loading the movie...
_root.createEmptyMovieClip("emptyClip",1);
//...for the loaderbar
_root.createEmptyMovieClip("outLine",2);
_root.createEmptyMovieClip("movieLoader",3);
_root.createEmptyMovieClip("textLoader",4);
_root.movieLoader._x = xDist;
_root.movieLoader._y = yDist;
_root.textLoader._x = xDist;
_root.textLoader._y = yDist;
_root.outLine._x = xDist;
_root.outLine._y = yDist;
//positioning the loading child movie outside the preloadmovie
_root.emptyClip._x = 1000;
_root.emptyClip._y = 1000;
_root.emptyClip.loadMovie(lTarget);
//creating textfields
_root.textLoader.createTextField("bytesField",4,0,bHeight+20,120,15);
_root.textLoader.bytesField.textColor = bColor;
_root.textLoader.createTextField("frameField",5,0,bHeight+40,120,15);
_root.textLoader.frameField.textColor = bColor;
_root.textLoader.createTextField("totalField",6,0,bHeight+60,120,15);
_root.textLoader.totalField.textColor = bColor;
//creating the outline for loaderbar
if (bColor != null) {
_root.outLine.lineStyle(1, 0x000000, 100);
_root.outLine.moveTo(-1,-1);
_root.outLine.lineTo(102,-1);
_root.outLine.lineTo(102,bHeight+1);
_root.outLine.lineTo(-1,bHeight+1);
_root.outLine.lineTo(-1,-1);
}
//loading and monitoring the movie with the MovieClipLoader class
_root.onEnterFrame = function() {
//getting total bytes
totalBytes = _root.emptyClip.getBytesTotal();
//loded bytes defining
loadedBytes = _root.emptyClip.getBytesLoaded();
//bytes loaded
bytes = Math.round((loadedBytes/1024)*1000);
//% loaded
perLoaded = Math.round((loadedBytes/totalBytes)*100);
//defining the loading status for loaderbar
frame = Math.round((loadedBytes/(totalBytes/100)));
if (bColor != null) {
var lsFrame:Number = frame;
} else {
var lbFrame:Number = frame*10;
}
//after loading remove all objects and go to indicated frame
if (loadedBytes > 4 && loadedBytes>=totalBytes) {
delete _root.onEnterFrame;
//*********** REPLACING THE PRELOADER MOVIE WITH THE LOADED MOVIE *******************\\
//set level to "0" to replace or "1" to have movie in level1
loadMovieNum(lTarget,1);
//************************************************** **********************************\\
removeMovieClip(_root.movieLoader);
removeMovieClip(_root.outLine);
removeMovieClip(_root.textLoader);
} else {
if (frame > 1) {
if (bColor != null) {
//creating the fill for loaderbar
_root.movieLoader.beginFill(bColor,bHeight);
_root.movieLoader.moveTo(0,0);
_root.movieLoader.lineTo(lsFrame,0);
_root.movieLoader.lineTo(lsFrame,bHeight);
_root.movieLoader.lineTo(0,bHeight);
_root.movieLoader.lineTo(0,0);
_root.movieLoader.endFill();
} else {
_root.movieLoader.attachMovie("loaderBar","loaderBar",1);
_root.movieLoader.loaderBar._xscale = lbFrame;
}
//showing the bytes and % loaded in textfield
_root.textLoader.totalField.text = "total bytes: "+totalBytes;
_root.textLoader.bytesField.text = "bytes loaded: "+bytes;
_root.textLoader.frameField.text = "% loaded: "+perLoaded;
}
}
}
}
}
ehegyi
12-24-2004, 03:41 AM
Thanks cancerinform,
Your script looks very promising. I'll implement it tommorow (too tired tonight) and I'll post back here to let you know how it goes.
ehegyi
Hmmmm ???
what does not work whit my code ???
--->
By the way after 1 hours i was abel to bring the component itself to work whit out
lockroot or anything else (just debug the original code from MM)
OK it's not perfect it woud need more time (which i not wana inwest)
the only problem (at least seams so) is that after my alterations the GREEN border around the popup is not ereased till a second click to a combobox :(
it's the first time that i was go so depth to the roots so i am reali impressed by mi self
:D
just not understand why MM not corect this for them it shoud by a pice of cake
ehegyi
12-24-2004, 01:21 PM
Hi Xeef,
Yes I apologise your code definately does work within the fla you sent me. What's interesting is that when I drag/drop a combobox from my components library onto the stage of your test.fla and replace the underlining combobox code, both comboboxes stop working. I'm using mx2004 version 7.2. Which version of the flash are you using. If it's earlier then a new bug has crept into the combo box code after the update. If your using the same version as me then I'm relly confused as I've been through you files and mine and I see no other differences between the two.
I'm going to have a look at the combox code as well (always an adventure!).
ehegyi
ehegyi
12-24-2004, 05:30 PM
Hi cancerinform,
Thanks, your virtual preloader worked very well. I had never realised that it's possible to load a swf, then "virtually" reload it to change it's position within the movie. Nice work!
ehegyi
cancerinform
12-24-2004, 06:02 PM
You can use the script also if you have complex movies with components. Just change the level to 0 where indicated and create a parent fla.
Happy holidays ;)
Hmmm
Ver 7.2
intresting !??
cancerinform
12-25-2004, 12:50 AM
Xeef,
haven't you upgraded yet to 7.2?!
:p
was maiby a bit unclear
MY Ver 7.2
:)
and it's intresting that it's not working by ehegyi
Jozzle
07-27-2005, 10:19 AM
Xeef,
Have you found a sollution for your problem with the green border, as it only disapears after a second click?
Jozzle
07-27-2005, 10:55 AM
Ok,
When the library of the main movie, wich loads the secundairy movies with comboboxes, contains a combobox component (drag a component on stage and delete it) none of the bugs described in this topic will appear...
*Greets
penmig
11-24-2005, 12:30 AM
Hi there, may be the solution is here
http://www.macromedia.com/support/flash_re...ts/combobox.htm
Have a nice day
Miguel
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.