Macromedia Flash Professional 8 UNLEASHED [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Macromedia Flash Professional 8 UNLEASHED [Electronic resources] - نسخه متنی

David Vogeleer, Eddie Wilson, Lou Barber

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






The loadVariablesNum() Method


The loadVariablesNum() method is similar to the loadVariables() method in that it loads external variables into Flash, but unlike the loadVariables() method, the loadVariablesNum() method loads the variables into a level instead of directly into a movie clip.

The basic layout of this method looks like this:


loadVariablesNum(URL, level, method);

Following are the parameters that loadVariablesNum will accept:

  • URL
    The path to either the text file being loaded or the middleware page being called.

  • level
    The level in the Flash player to receive the variables when they are loaded.

  • method
    This is an optional parameter used to define the method used when transferring data to and from middleware.


It also supports the onData event as a means of announcing when data has been fully loaded.

Here is an example using the loadVariablesNum() method:


1.

Create a new Flash document.

2.

Save this document as

sample-20-4.fla in the same directory as the text files you have been working with.

3.

In the first frame on the main timeline, open the Actions panel and place these actions in it:


//get the data from the text file
loadVariablesNum("sample.txt",0);
//when the movie receives the data
this.onData = function(){
if(init){
trace("my name is - "+this.name);
trace("my age is - "+this.age);
trace("my location is - "+this.location);
}else{
init=true;
}
}


Notice that this time, we use a conditional statement to make sure that the event is not accidentally being triggered by the main timeline's initialization. Also notice that we are calling the original text file we created, not the one we used to put in an array.Figure 20.4.

But the two methods we have covered in regard to loading external data are not the end. There is even a built-in object specifically designed for interfacing with external data.


/ 318