Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




OnData With Dynamicly Created MC



Hi Im dynamically creating an empty movie clip and then loading in an external swf into it.

heres my code so far (a simplified version) and it works fine.

function CreateField(Elm){
Ad.createEmptyMovieClip("McElm"+Elm, Elm)
Ad["McElm"+Elm].loadMovie("Test.swf");
}

I need to detect when the Test.swf has loaded using onData but not sure how to do it with a dynamically created movie clip. I tried adding this to my function but it didn't work

Ad["McElm"+Elm].onData = function(){
Loading="Done"
}

Can anyone let me know how to do this please.
Thanks
-Rob

P.S. I don't want to put any code in the movie im loading (Test.swf) for reasons I wont go into.



Ultrashock Forums > Flash > ActionScript
Posted on: 2004-06-02


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Target Dynamicly Created Mc
I cant see were i am going wrong. Trace returns undefined.
code:
trace ("holder=" + _parent.holder['news'+ID].txTitle.text);

How it's attached
code:
for (count = 0; count < result_lv.newsCount; count++) {
holder.attachMovie ("news", "news" + count, count);
holder["news" + count]._y = nextY;
holder["news" + count].newsTitle = result_lv["news" + count + "newsTitle"];
holder["news" + count].newsID = result_lv["news" + count + "newsID"];
holder["news" + count].newsDate = result_lv["news" + count + "newsDate"];
holder["news" + count].newsStory = result_lv["news" + count + "newsStory"];
nextY += holder["news" + count]._height - 2;
}

Anyone

Thanks

Target Dynamicly Created Mc
I cant see were i am going wrong. Trace returns undefined.

ActionScript Code:
trace ("holder=" + _parent.holder['news'+ID].txTitle.text);
How it's attached

ActionScript Code:
for (count = 0; count < result_lv.newsCount; count++) {
    holder.attachMovie ("news", "news" + count, count);
    holder["news" + count]._y = nextY;
    holder["news" + count].newsTitle = result_lv["news" + count + "newsTitle"];
    holder["news" + count].newsID = result_lv["news" + count + "newsID"];
    holder["news" + count].newsDate = result_lv["news" + count + "newsDate"];
    holder["news" + count].newsStory = result_lv["news" + count + "newsStory"];
    nextY += holder["news" + count]._height - 2;
}
Anyone

Thanks

Dynamicly Created Textfield Not Having Name
Hey everyone,

I've made a bunch of buttons, using attachMovieClip, and then i've created text fields in each of them using actionscript. Yet for some reason the text fields don't seem to have instance names, so i can't give them text or anything. The code i use is as follows


ActionScript Code:
for (i=0; i<5; i++) {
    for (j=0; j<4; j++) {
        _root.attachMovie("CalcButton", ButtonNames[i][j], i*5+j*4); //"CalcButton" is the linkage name for the button in the library, this bit works fine
        _root[ButtonNames[i][j]]._x = 70 + i * 50
        _root[ButtonNames[i][j]]._y = 120 + j * 50
        _root[ButtonNames[i][j]].createTextField("Box" + i+ "," + j, 50*i+j, -5.1, -16, 15, 30) // As far as i'm aware, the "Box" + i + "," + j should give it an instance name of, for example, "Box0,1"
        _root[ButtonNames[i][j]].Box.type = "dynamic"
        _root[ButtonNames[i][j]].Box.textColor = "0xFFFFFF"
        _root[ButtonNames[i][j]].Box.text = ButtonLable[i][j]
        trace(_root[ButtonNames[i][j]].Box.text)
    }
}

Instead of having the instance name i specify, they have the name "instance whatever" when i click list objects in the debug menu. Thanks in advance

Duplicate, Then Scroll Dynamicly Created MC's?
I'd like to Duplicate, then scrolling dynamicly created MC's.

Is this possible? How would you try to do it?

Basicly, I want a movie clip to be copied several times whilst inside another movie clip which then can be scrolled to view it.

In theroy this is fairly simple getting it to work is another thing though. What I am trying to make is simular to a forum.

I would appreciate thoughts and suggestions.

Thanks =)

Getting Property From A Dynamicly Created Movieclip
I used "createEmptyMovieClip2 to create a movie that I use as an image holder.

I need to get the scale of it once the external .jpg image have been loaded but the getproperty function doesn't work, it give me 0 as a result. Any suggestions?

Thanks

Navigating In A Dynamicly Created Moiveclip
OK, so I thought I was supposed to use MovieClips insted of Sprites due to the fact that there is a timeline inside of a movie clip. So here is my delima, I am getting all the information I need loaded and displayed, just all on the same frame.

If you look at the snippit from my code, right before my nested for loop i tell content_mc to goto frame(i+1) , but when i trace the currentFrame I am always returned zero. as well as all the text fields created sitting on top of eachother.

I believe I am correct in assuming if I can get the content_mc to navigate correctly, the rest should just fall into place.





Code:
var content_mc:MovieClip = new MovieClip();

for(var i:int = 0; i < linkList.length(); i++)
{

content_mc.gotoAndStop(i+1);
trace(i+1);//returns consecutive numbers
trace(content_mc.currentFrame) //returns 0
for(var j:int = 0; j < linkList[i].content.length(); j++)
{
//content_mc.name = "content_" + i + "_" + j;
linkContent = new XMLList(linkList[i].content[j]);
var docTitle_txt:TextField = new TextField();
docTitle_txt.multiline = true;
docTitle_txt.wordWrap = true;
docTitle_txt.autoSize = "left";
docTitle_txt.width = 350;
docTitle_txt.multiline = false;
docTitle_txt.text = linkList[i].content[j].attribute("linkName");
content_mc.addChild(docTitle_txt);

var docDesc_txt:TextField = new TextField();
docDesc_txt.y = docTitle_txt.y+docTitle_txt.height+5;
docDesc_txt.multiline = true;
docDesc_txt.wordWrap = true;
docDesc_txt.autoSize = "left";
docDesc_txt.width = 375;
docDesc_txt.text = linkList[i].content[j];
content_mc.addChild(docDesc_txt);

var docURL:String = linkList[i].content[j].attribute("url");


trace(linkContent.attribute("url"));
}
}
addChild(content_mc);



thanks in advance,
D

Writing To A Dynamicly Created Object?
So, heres the set up.

I have an array with a list of URLs.

I have a for loop duplicating an MC (to the exact length of the afore mentioned array).

I need the newly created MCs to each "grab" the URL info off the array so it can be used within the MC.

I have a feeling there is a simple solution here that I cant seem to hit.

Thanks in advanced,

-diss

How Do You Trace A Dynamicly Created Childs Name?
migrating from as2...new to as3, need to find out what would be the instance names of the following items (can't work this out.....doh!!!):


ActionScript Code:
//Imports needed for animation
import caurina.transitions.Tweener;
//XML file path
var xmlPath:String = "xml/site.xml";

//The XML data will be inserted into this variable
var settingsXML:XML;

//Array used for the tween so they won't get garbage collected
var tweensArray:Array = new Array();

// Load the XML file
var loader = new URLLoader();
loader.load(new URLRequest(xmlPath));
loader.addEventListener(Event.COMPLETE, xmlLoaded);

//This function is called when the XML file is loaded
function xmlLoaded(e:Event):void {

    //Make sure we're not working with a null loader
    if ((e.target as URLLoader) != null ) {
        //Insert the loaded data to our XML variable
        settingsXML = new XML(loader.data);
        settingsXML.ignoreWhitespace = true;
        //Call the function that creates the whole menu
        createMenu();
        trace(parent.height);
    }

}
function createMenu():void {
    //This will be used to represent a menu item
    var menuItem:MenuItem;
    //Counter
    var i:uint = 0;

    //Loop through the links found in the XML file
    for each (var link:XML in settingsXML.links.link) {

        menuItem = new MenuItem();

        //Insert the menu text (link.@name reads the link's "name" attribute)
        menuItem.menuLabel.text = link.@name;
        menuItem.projectTyp.text = link.@projectTyp;
        menuItem.client.text = link.@client;
        menuItem.dateTxt.text=link.@dateTxt;
        menuItem.xmlFile=link.@xmlFile;
        //If the text is longer than the textfield, autosize so that the text is
        //treated as left-justified text
        menuItem.menuLabel.autoSize = TextFieldAutoSize.LEFT;

        //Insert the menu button to stage
        menuItem.x = 0;
        menuItem.y = 0 + i*50;

        //Make the button look like a button (hand cursor)
        menuItem.buttonMode = true;
        menuItem.mouseChildren = false;

        //Add event handlers (used for animating the buttons)
        menuItem.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
        menuItem.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
        menuItem.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
        //attach the menu objects
        addChild(menuItem);
        //set the bg mc's bg to alpha=0;
        menuItem.bg.bg.alpha=0;
        //Increment the menu button counter, so we know how many buttons there are
        i++;

    }
}
//Function is called when the mouse is over a menu button
function mouseOverHandler(e:Event):void {

    //trace(e.target.name+" has been rolled over");
    Tweener.addTween(e.target.bg.bg,{alpha:1,time:0.25,transition:"easeOutLinear"});

}

//Function is called when the mouse moves out from the menu button
function mouseOutHandler(e:Event):void {
    /*Tween back original scale
     buttonTween = new Tween(e.target.bg, "scaleX", Elastic.easeOut, e.target.bg.scaleX, 1, 1, true);*/

    Tweener.addTween(e.target.bg.bg,{alpha:0,time:0.25,transition:"easeOutLinear"});

}


what the hell are these called (menuItem = new MenuItem())

trace(e.target.name) isn't right, cant work out what my mc's are called

Problem With OnRelease Set On Dynamicly Created Mcs
Hi!
Ok, im trying to do a photogallery here, dynamically loaded from a XML. The XML part is perfectly working, i can create my movieclips with no problem either, and place them where i want them. the thing now is that even if i try to add a onRelease event on each mc i dynamically create, it doesnt seem to work. Im sure its something really easy that i just dont understand, but im stuck here and the project is due in a week (with still many things to complete...)

So any help would be more than appreciated.

Heres the loop where i create my mcs and attach them to my thumbnail container mc:


PHP Code:



for (i=0; i<_root.pix_number; i++) {
  // if theres more than 10 pictures, we add another film overlay
  if (count > 20) {             
    _root.film.thumbs.attachMovie("film_overlay","overlay"+i,i);
    new_film = _root.film.thumbs["overlay"+i];
    new_film._x = -1847;
    count = 1;
  }
                
  var mc = film.thumbs.pix_container.createEmptyMovieClip("mc" + i, i);
  // Position the new mc
  mc._x = 705 - (i*70 + (6.8*(i+1)));
  mc._y = 15;

  // Adds a event listener to the thumbnail so that when its clicked
  // it loads a picture in the photobucket
  mc.onRelease = function () {
    trace("mc clicked");
    // load photo in photobucket
  }
                
  var url = "images/" + pixArray[i].thumbnail;
  myLoader.load(mc, url);
  count++;





myLoader is a qlod.loaderClass object here. I just cant click on the pictures to make them load a bigger one in the frame i have.

Any help would be greatly appreciated...THANKS

Dynamicly Created MCs With OnPress Functions
I thought I could figure it out, but I guess not. I am dynamically creating movie clips to load images into. The image path is in an XML file and my AS reads the XML file perfectly and loads the images appropriately. In my XML file there are nodes that represent paths to the thumbnail and to the full size image. I know the XML is being read because I have traced the value I asigned to the full size image path and it is reading and incrementing as I wanted. The problem is when I try to dynamically add a function to the MC at the time of creation that would will open a seperate window with the large image I get nothing. Here is my code:


ActionScript Code:
thumbs_xml=new XML();
var cbselect;
cbselect = gal_cb.selectedItem.data;
thumbs_xml.onLoad = startLoadImage;
thumbs_xml.load(cbselect);
thumbs_xml.ignoreWhite = true;
//
//
function startLoadImage(success){
        if (success=true){
                var strNewName;    
                var strPrevName;               
                var nImageCounter = 0;
                var aImageCounter = 0;
                var xPos = -80;
                var yPos = 70;
                var nrow = 0;
                var r2xPos = 10;
                var r3xPos = 10;
                var r4xPos = 10;
                var r5xPos = 10;
                var r3yPos = 140;
                var r4yPos = 210;
                var r5yPos = 280;
               
                for (var n = 0; n<thumbs_xml.firstChild.childNodes.length; n++){
                        if(thumbs_xml.firstChild.childNodes[n].nodeType ==1 ){
                                strPrevName = "holder" + nImageCounter;        
                                nImageCounter = nImageCounter + 1;
                                xPos = xPos + 90;
                                nrow = nrow + 1;                               
                                strNewName = "holder" + nImageCounter;
                                                                                               
                                var strThumbSrc = thumbs_xml.firstChild.childNodes[n].attributes.thumb;
                                var strMainSrc = thumbs_xml.firstChild.childNodes[n].attributes.main;
                                var strExt = thumbs_xml.firstChild.childNodes[n].attributes.ext;
                               
                                strLgImg = strMainSrc + nImageCounter + strExt;              
                                                               
                                holdermask[strPrevName].duplicateMovieClip(strNewName,nImageCounter);
                                holdermask[strNewName].loadMovie(strThumbSrc);
                                holdermask[strNewName].onPress = function(){
                                    getURL((strLgImg),"_blank");
                                }                        
                                if((nrow>=6) && (nrow<=10)){
                                    holdermask[strNewName]._y = yPos;
                                    holdermask[strNewName]._x = r2xPos;      
                                   
                                    r2xPos = r2xPos + 90;
                                }
                                else if((nrow>=11) && (nrow<=15)){
                                    holdermask[strNewName]._y = r3yPos;
                                    holdermask[strNewName]._x = r3xPos;
                                   
                                    r3xPos = r3xPos + 90;
                                }
                                else if((nrow>=16) && (nrow<=20)){
                                    holdermask[strNewName]._y = r4yPos;
                                    holdermask[strNewName]._x = r4xPos;
                                   
                                    r4xPos = r4xPos + 90;
                                }
                                else if((nrow>=21) && (nrow<=25)){
                                    holdermask[strNewName]._y = r5yPos;
                                    holdermask[strNewName]._x = r5xPos;
                                   
                                    r5xPos = r5xPos + 90;
                                }
                                else{
                                    holdermask[strNewName]._x = xPos;
                                }               
                                                                                         
                        }
               }
        }
}


To help understand the MC structure I have an MC on the stage named holdermask and then I have another blank MC nested inside that one named holder0. holder0 is the MC that I am dyamically duplicating.

Can anyone help?

Font In Dynamicly Created Input Field
hwn i use the code below. everything works fine. i set the text and the font shows up.

BUT when i try to type in the my created inputfeild the nothing happens.

the strange thing is that if i put the marker inside "test text"
and start typing, the font appears.

anyone else had this problem?

// my code
_root.createTextField("text0", 1, 50, 60, 300, 30);
with(text0){
embedFonts = true;
background = true;
type = "input"
}
idleStyle = new TextFormat();
with(idleStyle){
font = "Unicorn"
textColor = 0xff2222
type = "input"
size = 20
bold = true;
}
_root.text0.text = "test text" // this is just for testing
_root.text0.setTextFormat(idleStyle);

_root.text0.onChanged = function(){
_root.text0.setTextFormat(idleStyle);
}
//

cheers TOYOTOTA

[CS3] [AS2] OnPress Function On Dynamicly Created Buttons ?
I am trying to make a XML Gallery , it's going to create buttons dynamicaly with code and on press load appropriate image .

But i have no idea how to put onPress function to those buttons ?

Target Dynamicly Created Movie Clips Help
Hi everybody,

I have a question about targeting a number of instances that were created dynamicly at the same time.
I can target them manually, but that is a pain.
For example:

_root.clips_masked.loadClipsInfos.clip_info1.box_m c._alpha = 100;
_root.clips_masked.loadClipsInfos.clip_info2.box_m c._alpha = 100;
_root.clips_masked.loadClipsInfos.clip_info3.box_m c._alpha = 100;
_root.clips_masked.loadClipsInfos.clip_info4.box_m c._alpha = 100;
_root.clips_masked.loadClipsInfos.clip_info5.box_m c._alpha = 100;

can someone tell me how to set a variable maybe that says x>0
_root.clips_masked.loadClipsInfos.clip_info[variable].box_mc._alpha = 100;

THANKS!!!

Displaying Array Items In Dynamicly Created Mcs
I'm creating my first game. So please excuse the verbose code.

I have an object containing an array each item has an attachMovie. I then have a function that randomly chooses 5 items from the array and makes them visible. They are then draged to targets to hitTest and then scored. My problem comes in when displaying the results (which items they got right and which were wrong). I have created another array to hold the results. What I want to be able to do is display each array item in it's own text box within a container that also displays a picture of the item. I'm not sure wheather this makes much sense to discripe so I'll attach a file.

I've tried a couple of ways of doing this;
Displaying the whole array in a text box gives the desired information but has limitations with html formating and displaying a image of the item. Because they are dynamicly named I can'f figure out a way of getting that name into the img tag.

The other way I've tried is to create the text boxes and items in the same loop that chooses the random items. This displays well but the information to fill the text boxes ie the score dosen't exist yet so it's undefined.

Any suggestions?

Attach A Movie To A Dynamicly Created Clip
I was wondering the syntax for how to dynamically create name to attach a method statement to (I probably said that totally wrong, I haven't got all the terminology yet). This is a sample of what I have so far (the underlined part is where I need the help):


Code:
timer = timer + 1
if (timer = 20)
{
set =+ 1;
createEmptyMovieClip("laser1"+set,getNextHighestDepth());
lname = "laser1"+set;
_root.(laser1+set).attachMovie(laser1,"laser1",_root.(laser1+set).getNextHighestDepth());

timer = 0
}
This problem has probably been answered before but I don't know the words to use to search for the answer. So if you could answer it again or even direct me to another thread or tut it would be of great help. Thanks in advance.
P.S. How do you create an actionscript code box?

Place Dynamicly Created MCs Inside Existing MC?
Hi there,

Can anybody help me out here please...

EDITED --> Please look further down for question

Thanks

Referance A Dynamicly Created Movie Clip
using this code:

Code:
this.createEmptyMovieClip("myMovieClip", 10);
and then make that movie clip a button. I know it has to be in how I referance it but I can not seem to figure it out.
I can make it load an image but can not make it clickable. Here is that total code that I am using:

Code:

this.createEmptyMovieClip("myMovieClip", this.getNextHighestDepth(), {_x:100, _y:100});;
myMovieClip.loadMovie("http://www.macromedia.com/images/sha...o_flashpro.jpg");
//This is the part that does not work
myMovieClip.onRelease = function(){
trace("button hit")
}

Can I Have Rounded Corners On My Bitmaps Created Dynamicly?
Hello

ok a quick run down what i have managed to (learn) create

I read through a .xml file with a list of .jpg file names
Each .jpg is then loaded and drawn into a bitmap
Each bitmap has a .onPress control so (eventualy when i have learnt howto) a .html or .php will be called.

Each bitmap is placed across the screen at 45 degree angle in a brick wall style layout.
e.g.
.XXX XXX XXX XXX
. XXX XXX XXX
.XXX XXX XXX XXX

ok what i need now to learn is to give each bitmap rounded corners. Is this possible. It has taken me so long just to learn what i have so far!!!!
Many thanks for any help
Mike :o)

Referance A Dynamicly Created Movie Clip
using this code:

Code:
this.createEmptyMovieClip("myMovieClip", 10);
and then make that movie clip a button. I know it has to be in how I referance it but I can not seem to figure it out.
I can make it load an image but can not make it clickable. Here is that total code that I am using:

Code:

this.createEmptyMovieClip("myMovieClip", this.getNextHighestDepth(), {_x:100, _y:100});;
myMovieClip.loadMovie("http://www.macromedia.com/images/sha...o_flashpro.jpg");
//This is the part that does not work
myMovieClip.onRelease = function(){
trace("button hit")
}

Referance A Dynamicly Created Movie Clip
using this code:


Code:
this.createEmptyMovieClip("myMovieClip", 10);
and then make that movie clip a button. I know it has to be in how I referance it but I can not seem to figure it out.

I can make it load an image but can not make it clickable. Here is that total code that I am using:


Code:


this.createEmptyMovieClip("myMovieClip", this.getNextHighestDepth(), {_x:100, _y:100});;

myMovieClip.loadMovie("http://www.macromedia.com/images/shared/product_boxes/80x92/studio_flashpro.jpg");

//This is the part that does not work

myMovieClip.onRelease = function(){

trace("button hit")

}

Dynamicly Created Movieclip/sprite And .width Property
I have a question on WHEN you can read the width of a dynamically created sprite.

I have a gallery package - the gallery.as file creates a thumbContainer (MovieClip) and adds each thumbnail (sprite) in a for loop, iterating through an array.

Within the for loop, i try to trace the width of the thumbContainer, but it always returns 0. What gives? I need the final width to make some calculations for the scrolling of the thumbnails to work.

I can get the final width using certain methods, such as returning the width on MOUSE_MOVE. I was able to get the width using the eventListener Event.ADDED, but that stopped working when loading images off my server instead of locally (wtf is that about?).

Can anyone give some clarification on dynamically created containers and their properties (specifically reading their width property) ?

[SOLVED] Problem "accessing" Dynamicly Created Movieclips
Hello.

I have this function which adds a bunch of MC's to the stage. This function gives them separate names but when i try to, lets say, change the alpha of one of them i get this error:

Adobe Flash CS3 Professional's Output wrote:A term is undefined and has no properties.
at index_fla::MainTimeline/frame1()

Check If The Mouse Is "rollovering" A Dynamicly Created MC?
Hello,

I need help with something...

Is there a way a check if the mouse is "rollovering" a dynamicly created MC? the MC name must contains a same word + a digit

like _root.myMC1 , _root.myMC2 , _root.myMC3 ...

TiA

Check If The Mouse Is "rollovering" A Dynamicly Created MC?
Hello,

I need help with something...

Is there a way a check if the mouse is "rollovering" a dynamicly created MC? the MC name must contains a same word + a digit

like _root.myMC1 , _root.myMC2 , _root.myMC3 ...

TiA

Alias Text For Dynamicly Created Text Field
Does anyone know how to set a text fields alias properties when the text fields has been created in code dynamically.

Loading A Swf Dynamicly Which Also Loads A Swf Dynamicly ?
ok; here is the situation;
i have three movies
first one is A
second B
and the third C
B loads C dynamically when pressed a button in it
A loads B dynamically when pressed a button in it
here is the problem;
I open A and pressed the button to load B dynamically, everthing is ok, B is loaded...
But then when i press the button (on dynamically loaded B) to load C, nothing happens?

isn't it possible in flash mx to load something dynamically, from a movie which is loaded also dynamically?

sorry for my awful english & thanks for replies...

Loading A Swf Dynamicly Which Also Loads A Swf Dynamicly ?
ok; here is the situation;
i have three movies
first one is A
second B
and the third C
B loads C dynamically when pressed a button in it
A loads B dynamically when pressed a button in it
here is the problem;
I open A and pressed the button to load B dynamically, everthing is ok, B is loaded...
But then when i press the button (on dynamically loaded B) to load C, nothing happens?

isn't it possible in flash mx to load something dynamically, from a movie which is loaded also dynamically?

sorry for my awful english & thanks for replies...

Animation Created By Action Script Or Created Handle
What's "heavier" for the CPU/screen refreshing.. animation created by Action Script or created handle - using motion tweening?

Tanks in advance,
Maya.

Animation Created By Action Script Or Created Handle
What's "heavier" for the CPU/screen refreshing.. animation created by Action Script or created handle - using motion tweening?

Tanks in advance,
Maya.

OnData Help
Hey guys,

I need some help ... I find out a way to get a text file in without using variables ...

example

bCode,bItemName,bDescription,bPics,bPrice
SM,Small Box,16"x12"x12",smallBox.jpg,$1.99
MED,Medium Box,18"x18"x16",mediumBox.jpg,$2.99

this is how I get the data in

code:
var _lv = new LoadVars();

_lv.onData = function(dat) {
var input_arr = dat.split('
');
if (input_arr.length==1) {
input_arr = dat.split('
');
}
for (i=1; i<input_arr.length; i++) {
trace(input_arr[i].split(','));
}
};
_lv.load("testFile2.txt");


he is the issue ...

I'm never going to know how many rows there is going to be at any givin time ...

so what I'm asking is ... I need a way to split each row (once in flash) in its own array ... so that I can take out different indexes ...

I tried using a for loop to it didn't work ...

I'm guessing I need to know how to make dynamic arrays ...

please someone help

thanks

-S

OnData ? For Jpg's
Hi,
I am loading jpg's, and I want to make a Movieclip('MC') invisible when there is no jpg to load (because it just is not there). How can I detect if there is no jpg, and then make the MC invisible? I think I should use onData, but I can't make it work.


Code:
function laadNail3(foto) {
var my_lv:LoadVars = new LoadVars();
my_lv.onData = function(src:String) {
if (src == undefined) {
MC._visible = false;
}
foto = src;
};
my_lv.load(foto, holder);
}

I am also confused where to put the Movieclip that holds the jpg ('holder')?

The data passed to the function comes from another swf, saying:

Code:
laadNail3("b3.jpg");


Could someone show me how to do this?

thank you,

Jerryj.

OnData?
Hey!

is there a way to do something if there's any content loading into your main movie? something like:


Code:
_root.onData = function(){
trace('data is loading');
}

Hope someone knows it

OnData Jpg
Hi,
I am loading jpg's, and I want to make a Movieclip('MC') invisible when there is no jpg to load (because it just is not there). How can I detect if there is no jpg, and then make the MC invisible? I think I should use onData, but I can't make it work.

ActionScript Code:
function laadNail3(foto) {    var my_lv:LoadVars = new LoadVars();    my_lv.onData = function(src:String) {        if (src == undefined) {            MC._visible = false;        }        foto = src;    };    my_lv.load(foto, holder);}

I am also confused where to put the Movieclip that holds the jpg ('holder')?

The data passed to the function comes from another swf, saying:
laadNail3("b3.jpg");[/as][as]

Could someone show me how to do this?

thank you,

Jerryj.

OnData
I have been piecing some code together to try to get this working and am still having some problems, I can get the connection to establish but I cannot get the onData function to work. If anyone has any insight to this it would be greatly appreciated!

function lsOnConnect(success) {
if (success) {
trace ("Connection succeeded!")
} else {
trace ("Connection failed!")
}
}


var socket = new XMLSocket();
socket.onConnect = lsOnConnect
if (!socket.connect('ipnumber', 0000)) {
trace ("Connection failed!")
}


socket.onData = function(success){
if (success){
trace ("loaded");
}
else {
trace("XML did not load");
}
}

OnData?
Hey!

is there a way to do something if there's any content loading into your main movie? something like:


Code:
_root.onData = function(){
trace('data is loading');
}

Hope someone knows it

OnData (?)
am i doing something wrong here or can i not use onData with loadMovie?


Code:

createEmptyMovieClip("target", 1);
target._x = target._y = 100;
target.onData = function () {
trace("movie has been loaded");
};
target.loadMovie("theimage.jpg");

OnData Not Being Called?
myMovieClip.onData = function(){
trace("on data called");
}

myMovieClip.loadMovie("picture.jpg");




why is it not calling onData?

OnData Not Working ?
Hi,

I built the site http://www.jps-foto.de/jps.htm, were a photographer shows his pictures. There are categories with thumbnails, each thumb an individual jpg being loaded by loadMovies. onData should check if they are complete.

On my system it works fine. On other systems (especially slow connections or Macs) sometimes there seem to be are problems. Switching too fast between the categories causes some kind of overload, even the transmission should stop.

At http://www.jps-foto.de/Saupe11test4.swf there is a test showing the player version and some variables at loading.

Does anybody have an idea? I checked the programming carefully, but there was some discussion about old players not loading correctly which should be working now.
It would be a great help to have information on what systems/players this doesn't work.

Mc.onData Problem...
I've tried, on numerous occasions, to use loadMovie with mc.onData = function() {} in MX. However, I can never seem to get it to work. According to the documentation, I can use onData with loadMovie commands to determine when the entire movie has finished loading. Unless my syntax is all screwed up, this doesn't seem to work.

here's a sample

loadMovie("movie.swf","clipName");

clipName.onData = function() {
trace("movie loading done");
}

This always fails...any thoughts?

Cheers

Quasi

OnLoad/onData
Tring to write a dynamic image display for any dimension jpg file.
Code i have written is as follows.

var depth=0
var i=0

createEmptyMovieClip("ImageHolder",depth)


this.onMouseDown=function()
{
loadImage()
}

function loadImage()
{
i++
Mov="Images/Image"+i+".jpg"

ImageHolder.loadMovie(Mov)
ImageHolder.onLoad=checkSize();
}


function checkSize ()
{
trace(ImageHolder._width)
//resize code to go here
ImageHolder._x=0
ImageHolder._y=0

}

loadImage()


this loads OK but the onLoad Event is triggered immediately rather than after Loading of the Image. As i want to change th properties of the ImageHolder Movieclip depending on its new dimensions this is causing a bit of a problem.


Has anyone had any problems with the .onLoad event and solved it, or can see any mistakes i am making.

Any help appreciated

OnData Event Help
thank you first for reading this
i got a little problem about MovieClip.onData event handler
I've check the event invoked when a movie clip receives data from a loadVariables or loadMovie call.
but the problem is
---------------------------
_root.createEmptyMovieClip("testMc",0);
testMc.onData = function(){
trace(this._width);
}
testMc.loadMovie("test.jpg");
------------------------------
didnt work! it only works when AS in onClipEvent(data)

can anyone tell me how to let it invoke?
or onData Event handler only works by use loadVariables?

Has Anybody Got OnData Working?
I've been braking my head for a good while now, trying to use the Movieclip.onData handler. It's supposed to be a listener, right? Why doesn't the following trace a thing??:


Code:
placeholder.onData = function () {
trace ("there's data");
}
loadMovie(temp, placeholder);


My objective, of course, isn't just tracing, but first things first. I've tried a number of other alternatives (always with onData), and none have worked out... anybody's ever gotten this event to work? Can anyone provide an example of code where it does work?

Thanks, everyone!

OnData Trouble
stop();
mc.onData = function() {
if (mc.getBytesLoaded() >= mc.getBytesTotal()) {
play();
}
};
mc.loadMovie(String(newpage)+".swf");

I am using this code to load a new page into a movie clip and check to see that it is entirely load befor playing, the reason i posted this is becuase it doesn't wor. please help

OnData Question
if i create a function using onData, does this occur when the data starts loading, or after it is completed? Testing locally, i am unable to tell the order of operation.

-myk

OnData Problem
I expect the onData function to be called when the jpg is completely loaded but it is not..What am I doing wrong!
Thanks!

this.Back_mc.prototype.loadImage = function()
{
this.createEmptyMovieClip( "instEmpty_mc", 2 );
this.instEmpty_mc.loadMovie( "trio.jpg" )

}

this.instEmpty_mc.onData = function()
{
this.instEmpty_mc._x = 160;
this.instEmpty_mc._y = -220;
this.instEmpty_mc._xscale = 5;
this.instEmpty_mc._yscale = 5;
}

MyMovieClip.onData
For what can be used this method?


Code:
myMovieClip.onData = function () {
trace ("onData called");
};
Thanks Jan

OnData Function?
I am loading external jpgs and swf files in my movie. I am trying to call a function when the external content loads. Right now I am using this code:


Code:
onClipEvent (data) {
//play closing transition
_root.closeTrans();
}
Here is the problem; the on data is unreliable. Sometimes it calls the function twice, or too early. What else can I do to call the action when the data finishes loading?

Using MovieClip.onData
Can you tell mi for which functioncan i use it please?

Any simple example?

Flash 5 And OnData
can any 1 explain me for which o when do i use the
MC.onData event, and if some 1 have an example code its great too!
on flash 5!!!
thnaks i nadvance
peleg

Copyright © 2005-08 www.BigResource.com, All rights reserved