1 ضمیمه
حرکت دادن یک Movie clip به وسیله ی کیبورد
خوب ، کار را با ایجاد یک Movie clip شروع می کنیم
1- یک Movie clip ایجاد کنید و آن را روی صحنه قرار دهید و به آن یک نام در قسمت Properties وارد کنید.(دراین تمرین نام my_mc movie clip است)
2- frame اول را انتخاب کنید و با زدن دکمه F9 پنل actions را باز کنید کد زیر را وارد کنید:
my_mc.onEnterFrame = function() {
توضیح : شما در این کد یک مدیریت کننده برای movie clip خود وارد کرده اید
3 - شما باید برای حرکت دادن movie clip به چند گزاره شرطی نیاز دارید پس کد زیر را در ادامه کد قبلی وارد کنید:
if (Key.isDown(Key.UP)) {
this._rotation = 0;
this._y -=30;
} else if (Key.isDown(Key.LEFT)) {
this._rotation = -90;
this._x -=30;
} else if (Key.isDown(Key.RIGHT)) {
this._rotation = 90;
this._x += 30;
} else if (Key.isDown(Key.DOWN)) {
this._rotation = 180;
this._y += 30;
}
توضیح:در کد بالا چهار شرط دارد که از if و else if برای تشخیص فشرده شدن کلید های بالا،پایین،راست و چپ استفاده می کند. چرخش و موقعیت movie clip بر حسب اینکه کدام شرط درست است تغییر می کند.
this - به معنی اشاره به movie clip است (my_mc )
rotation _ - به معنی چرخش movie clip است
y_ - موقعیت movie clip - y است
x_ - موقعیت movie clip - x است
4 - حالا شما برای محدود کردن حرکت movie clip به اندازه دلخواه باید این کد را به کد قبلی اضافه کنید:
if (this._x<=5) {
this._x = 5;
}
if (this._x>=300) {
this._x = 300;
}
if (this._y<=5) {
this._y = 5;
}
if (this._y>=300) {
this._y = 300;
}
توضیح: در این کد ما حرکت movie clip را در بین موقعیت های y=(5 to 300)
و x=(5 to300)
پیکسل قرار دارد .
5- در آخر با اضافه کردن( { )به آخر کد ، کار خود را پایان دهید.
در آخر کد شما باید مانند زیر باشد:
my_mc.onEnterFrame = function() {
if (Key.isDown(Key.UP)) {
this._rotation = 0;
this._y -= 30;
} else if (Key.isDown(Key.LEFT)) {
this._rotation = -90;
this._x -= 30;
} else if (Key.isDown(Key.RIGHT)) {
this._rotation = 90;
this._x += 30;
} else if (Key.isDown(Key.DOWN)) {
this._rotation = 180;
this._y += 30;
}
if (this._x<=5) {
this._x = 5;
}
if (this._x>=300) {
this._x = 300;
}
if (this._y<=5) {
this._y = 5;
}
if (this._y>=300) {
this._y = 300;
}
};
خسته نباشد
این هم یک مثال:
نقل قول: مرجع Action Script ...
من یه فایل فلشی رو تو فایل فلش دیگه لود کردم اما نمی دونم چطور ببندمش
نقل قول: مرجع Action Script ...
سلام.برای رکورد صدا به صورت آنلاین با فرمت amr و bitrate 12 kb می شه راهنمایی کنید.
نقل قول: مرجع Action Script ...
با سلام
من تعدادی عکس کوچک دارم که میخوام در یک صفحه باشه میخوام اسکرول باشه و یه عالمه عکس کوچک و مجزا رو با اسکرول بشه پیمایش کرد!
چطوری باید همچین چیزی بسازم.
نقل قول: مرجع Action Script ...
سلام
من قبلا قایل swf رو دیده بودم که به وبکم وصل میشد !!
این باعث شد که به این مقوله علاقه پیدا کنم؟ از کجا باید شروع کنم؟
اسم کد نویسی اون چی هست ؟ و تحت چه محیطی کد نویسی میشه ؟
امکان این وجود داره که متنی رو درون یک فایل txt در جایی مشخص مثلا My Documentesذخیره کنیم ?
نقل قول: مرجع Action Script ...
با سلام و تشکر از دوستان عزیز
مطالب قرار داده شده خیلی عالی بود چرا متوقف اش کردین؟