flash actionscript:
I created a flash file that get list of photos from database and then load them in flash using loadClip function and monitor them using onLoadInit event. It works good, but sometimes the photos don't appear and another time same photos appear! Isit a bug in action script language?! I'm using Flash 8 with Action Script 2.0 BR, Konstantinos
So, what do you think is it?
you have a scripting problem.
I'm attaching the code. gotoAndStop("bio"); if (Data.length == 7) { for (i = 0; i < 6; i++) { set("recordset_" + (i + 1), Data[i][0]); } photo_text_name = Data[1][0] + " " + Data[0][0]; recordset_11 = Data[6][0]; } else if (table_columns == "photoshop") { recordset_7 = (Data[0][0] == undefined) ? "" : Data[0][0]; } else if (table_columns == "periodfrom,periodto,town,country") { recordset_8 = Data[0][0] + "-" + Data[1][0]; recordset_10 = Data[2][0] + "-" + Data[3][0]; } else if (table_columns == "name") { recordset_9 = (Data[0][0] == undefined) ? "" : Data[0][0]; } else if (table_columns == "`name`") { archive_text = Data[0][0]; } else if (table_columns == "photoid,width,height,archiveid") { total_width = -10; for (i = 0; i < Data[0].length; i++) { if (i == 0) { var mclListener:Object = new Object(); mclListener.onLoadInit = function() { _root.tg_main._height = int((200 / Data[1][i]) * Data[2][i]); _root.tg_main._width = 200; _root.photo_name._y = _root.tg_main._y + _root.tg_main._height + 10; }; var mcLoader:MovieClipLoader = new MovieClipLoader(); mcLoader.loadClip("photos\\" + Data[0][i], _root.tg_main); mcLoader.addListener(mclListener); continue; } duplicateMovieClip(_root.slide_bar.photos_holder.photo_0, "photo_" + i, i); set("mclListener_" + i, new Object()); eval("mclListener_" + i).onLoadInit = function(target_mc:MovieClip) { i = substring(target_mc._name, 7, 1); Width = int((120 / Data[2][i]) * Data[1][i]); target_mc._x = total_width + 10; target_mc._y = -140; target_mc._width = Width; target_mc._height = 120; total_width += Width + 10; target_mc.origin_n = Data[0][i]; target_mc.origin_w = Data[1][i]; target_mc.origin_h = Data[2][i]; target_mc.origin_a = Data[3][i]; target_mc.onRelease = function() { _root.createEmptyMovieClip("pcm", 1); _root.pcm._x = int((1024 - this.origin_w) / 2); _root.pcm._y = int((768 - this.origin_h) / 2); _root.C_P._visible = true; _root.C_P._x = int((1024 - this.origin_w) / 2); _root.C_P._y = int(_root.pcm._y) + int(this.origin_h) + 20; _root.D_L._visible = true; _root.w_bg._visible = true; _root.mytimer.stop(); loadMovie("photos\\" + this.origin_n, _root.pcm); GetFromDB("SELECT `name` FROM `archivetype" + lang_suffix + "` WHERE id = " + this.origin_a, "load-bio"); }; if (total_width > 680) { _root.mytimer.play(); } }; set("mcLoader_" + i, new MovieClipLoader()); eval("mcLoader_" + i).loadClip("photos\\" + Data[0][i], "_root.slide_bar.photos_holder.photo_" + i); eval("mcLoader_" + i).addListener(eval("mclListener_" + i)); } }
[q][i]Originally posted by: [b][b]kglad[/b][/b][/i] you have a scripting problem. copy your moviecliploader and listener code and use the attach code option to paste it to this forum.[/q] Any ideas after positng of code?
none of the statements below should be in that for-loop: var mclListener:Object = new Object(); mclListener.onLoadInit = function(target) { // and this should be using the target movieclip _root.tg_main._height = int((200 / Data[1][i]) * Data[2][i]); // each target movieclip should have access to its i value _root.tg_main._width = 200; _root.photo_name._y = _root.tg_main._y + _root.tg_main._height + 10; }; var mcLoader:MovieClipLoader = new MovieClipLoader(); mcLoader.addListener(mclListener);
Don't see what you're looking for? Try a search.
|