ورود

نسخه کامل مشاهده نسخه کامل : در خواست سورس ساعت فلش براي موبايل



taha_nadri
22-11-2009, 23:14
با عرض سلام خدمت دوستان عزيز
اينكه من خيلي دنبال يه سورس ساعت فلش براي موبايل گشتم چيزي پيدانكردم مي خواستم كسي چيزي سراغ داره
ويه سوال ديگه كسي ميدونه چرا وقتي فايلهلي swfرو كه براي موبايل طراحي شده رو با يه برنامه تبديل به flaمي كنيم ديگه اجرانميشه و ثابت ميمونه
ممنون ميشم اگر كسي در اين مورد بتونه منو راهنمايي كنه
با تشكر

hadi.h18
25-12-2009, 21:10
ساخت ساعت ديجيتال :
ابتدا يه سند جديد باز کنيد و يک تکست فيلد ايجاد کرده و اون رو در حالت Dynamic قرار بديد و در قسمت var تايپ کنيد : clock
حالا با زدن کليد هاي Ctrl+F8 تکست فيلدتون رو به يک MovieClip تبديل کنيد :
حالا اين اکشن ها رو به مووي کليپتون متصل کنيد :

onClipEvent (enterFrame) {
time = new Date();
hour = time.getHours();
min = time.getMinutes();
sec = time.getSeconds();
clock = hour+":"+min+":"+sec;
}

اين اسکريپت در هر فريم يک آبجکت تاريخ خالي درست مي کند و فلش هم تاريخ هاي خالي را از کامپيوتر کاربر مي گيرد و ساعت ، دقيقه و ثانيه را به ترتيب در متغير هاي min ، hour و sec قرار مي دهد و سپس ان را در متغير clock ذخيره مي سازد ... حالا بايد ساعت شما کار کنه (دقت کنيد که چه رنگي براي تکست فيلد تون انتخاب کرديد)
ساخت ساعت عقربه اي :
اين ساعت هم مانند ساعت ديجيتال ساختار مشابهي داره و فقط به جاي اينکه ساعت و دقيقه و ثانيه رو توي تکست فيلد نشون بده ، عقربه ها رو ميچرخونه ...
يک مستطيل باريک روي صفحه ايجاد کنيد و به يک MovieClip تبديلش کنيد بعد دو بار Duplicate ش کنيد (Ctrl+D) حالا شکل ها رو به هر صورتي ميخوايد در بياريد ، اين شکل ها همون عقربه ها هستن .
بعد Instance Name عقربه هاتون رو به اين شکل تغيير بديد : ساعت شمار : hourmc دقيقه شمار : ‌ minmc ثانيه شمار : secmc
حالا به محيط ويرايش Movie Clip تون بريد و شکلتون رو به طرف بالا حرکت بديد طوري که محور MovieClip تون پايين عقربه باشه :
يک دايره کوچک براي مرکز ساعت رسم کنيد و به MovieClip تبديلش کنيد (فراموش نکنيد موقع تبديل موقعيت Registration را در حالت قرار دهيد) سپس اين شکل رو در مرکز شکل کلي ساعتتون قرار بديد :

حالا اين اسکريپت رو هم به همون MovieClip مرکز ساعت متصل کنيد :

onClipEvent (enterFrame) {
//-----------------------
_parent.secmc._x = this._x;
_parent.secmc._y = this._y;
_parent.minmc._x = this._x;
_parent.minmc._y = this._y;
_parent.hourmc._x = this._x;
_parent.hourmc._y = this._y;
//-----------------------
analog = new Date();
hour = analog.getHours();
min = analog.getMinutes();
sec = analog.getSeconds();
hour = hour + (min/60);
//-----------------------
_parent.secmc._rotation = sec*6;
_parent.minmc._rotation = min*6;
_parent.hourmc._rotation = hour*30;
}

در آخر کل شکلتون رو ميتونيد به يک MovieClip تبديل کنيد ...
قسمت اول اسکريپت براي مرتب سازي MovieClip هاي عقربه است به طوري که مکان هر عقربه رو به مرکز خود دايره مياره ...
قسمت دوم اسکريپت رو که قبلا توضيح دادم قستم ، قسمت سوم هم بااستفاده از ساعت و دقيقه و ثانيه ها ، خصيصه چرخش (rotation_) عقربه ها رو تنظيم ميکنه ...


اينهايي رو هم که تو پايين ميبيني همس واسه گوشي موبايله ولي انگليسيه

Step 1) Create a new flash document, set the resolution as your phones resolution.

(Etc. 176x220/240x320)

(If you want to set your own picture as the background, press Ctrl + R, if the picture isnt the correct size, use the transform tool to resize it.)

Step 2) Click on Publish:Settings.

Step 3) Click on the Flash tab and change the version to Flash Lite 1.1.



Step 4) Add a new layer and name it Time.( To add a layer, right click on your first layer and click Insert Layer.)

Step 5) Add a textfield to the layer.

Step 6) Type 99.99.99 in the textfield.

Step 7) Set the Text to Dynamic text.

Step 8) Type TIME in the VAR box.



Step 9) Create a new layer and name it Action Layer

Step 10) Right click on the first frame of Action Layer

Step 11) Click on Actions

Step 12) Copy and paste this code into the box:
Code:

fscommand2("GetLocaleTime", "TIME");

TIME_SEC = fscommand2("GetTimeSeconds");
// add leading 0 to hours
if (h<10) {h="0"+h;};

// add leading 0 to seconds
if (s<10) {s="0"+s;};

// add leading 0 to minutes
if (min<10) {min="0"+min;}



Step 13) Click on the first frame of the layer Time and press F5.



Step 14) Now press Ctrl + Enter to get a preview of your new swf clock wallpaper.



There, you have just finished your flash clock.

How to add a date:
Step 1) Make a new layer and name it Date

Step 2) Do steps 5 and 7 of the main tutorial.

Step 3) Type in the date like this: 2008-Nov-24

Step 4) Type in DATE in the VAR box.

Step 5) On frame 1 of the Action Layer, paste the below code above the previous code.
Code:

fscommand2 ("GetLocaleLongDate", "DATE");

Step 6) Now go to the 2nd frame of the Date layer and press F5.

You have just inserted the date.

How to add battery level bar:

Step 1) Make a new layer called battery

Step 2) Paste the below code above the code in the action layer

Code:

batt = fscommand2("GetBatteryLevel");
batt_txt = batt add " %";
setProperty("batt_fill", _xscale, batt);

Step 3) Go to the 2nd frame of the battery layer and press F5.

You have just added the battery level bar.


How to add the Volume Level Indicator:

Step 1) Make a new layer called Volume

Step 2) Paste the below code above the code in the action layer

Code:

vol = fscommand2("GetVolumeLevel");
vol_txt = vol add " %";

Step 3) Go to the 2nd frame of the Volume layer and press F5.

You have just added the Volume Level Indicator."

How to add a Now Playing Section


Step 1) Create a new layer Music.
Step 2) Create three dynamic text boxes.
Step 3) Set each text box's VAR as TIME, ARTIST, ALBUM respectively.
Step 4) Then add the below code to the Action layer or Music layer.
Code:

loadVariables("MP:",_root);
fscommand2 ("MP:", "TITLE");
fscommand2 ("MP:", "ARTIST");
fscommand2 ("MP:", "ALBUM");

You have just added a Now Playing Section

اميدوارم کمکي کرده باشم .