查看: 943|回复: 8
|
请教 Flash Action Script : 它们有什么/那里不一样?
[复制链接]
|
|
各位高手(尤其是超级-番茄)如题:它们有什么/那里不一样?:
on (press)
{ _root.playbackcontent = "contentbio"; <<< Hardcode over here already!
trace(string(_root.playbackcontent) +" != contentbio"); <<< show value
if (string(_root.playbackcontent) != "contentbio") <<< compare , if not same then execute
{ tellTarget("_root."+_root.playbackcontent)
{ gotoAndPlay(16); }
_root.desctxt._visible = false;
}
}
*** trace(string(_root.playbackcontent) +" != contentbio"); ***
这个的return 是: contentbio != contentbio
那里不一样呢?各位有什么办法?
为何两边都是 "contentbio" 但它还是会跑 gotoAndPlay(16)?
[ 本帖最后由 旌洋-君 于 29-5-2006 02:21 AM 编辑 ] |
|
|
|
|
|
|
|
发表于 29-5-2006 02:25 AM
|
显示全部楼层
原帖由 旌洋-君 于 29-5-2006 01:05 AM 发表
各位高手(尤其是超级-番茄)如题:它们有什么/那里不一样?:
*** trace(string(_root.playbackcontent) +" != contentbio"); ***
这个的return 是: contentbio != contentbio
那里不一 ...
你的代碼是Flash 4的寫法
第一行是定義一個變數 playbackcontent 並賦予字串 contentbio
第二行跳開trace是判斷文字内容是否為 contentbio ,string(_root.playbackcontent) 是強制轉換變數類型為字串
分別測試以下兩個例子
//例子1
_root.playbackcontent = ['contentbio']; //類型為object
if(string(_root.playbackcontent) != 'contentbio') //轉換為字串
{
trace('字串内容不是contentbio');
}
//例子2
_root.playbackcontent = 'abcd'; //類型為字串
if(string(_root.playbackcontent) != 'contentbio') //轉換為字串
{
trace('字串内容不是contentbio');
} |
|
|
|
|
|
|
|

楼主 |
发表于 29-5-2006 10:41 AM
|
显示全部楼层
哑。。。。。。。。不是很明白!
但我会努力去明白
我的 action script 写法是 flash 4 的写法!?!
没办法我是无师自通的,本人现在用着flash 8 pro
听了真悲哀 |
|
|
|
|
|
|
|
发表于 29-5-2006 09:40 PM
|
显示全部楼层
可能是Flash 4 或flash lite的方法吧...
试看改成:
on (press) {
_root.playbackcontent = "contentbio";
trace(String(_root.playbackcontent)+" != contentbio");
if (String(_root.playbackcontent) ne "contentbio") {
trace("enter");
tellTarget ("_root."+_root.playbackcontent) {
gotoAndPlay(16);
}
_root.desctxt._visible = false;
}
}
其实方法都是一样的... |
|
|
|
|
|
|
|

楼主 |
发表于 30-5-2006 11:24 AM
|
显示全部楼层
原帖由 懃 于 29-5-2006 09:40 PM 发表
on (press) {
_root.playbackcontent = "contentbio";
trace(String(_root.playbackcontent)+" != contentbio");
if (String(_root.playbackcontent) ne "contentbio") {
trace("enter");
tellTarget ("_root."+_root.playbackcontent) {
gotoAndPlay(16);
}
_root.desctxt._visible = false;
}
}
谢谢 我试试看 |
|
|
|
|
|
|
|
发表于 30-5-2006 01:41 PM
|
显示全部楼层
既然你都說自己在使用Flash 8的話﹐那麼為何不乾脆用flash 5以上的寫法
on(press) {
_root.playbackcontent = "contentbio";
if (_root.playbackcontent != "contentbio") {
_root[_root.playbackcontent].gotoAndPlay(16);
_root.desctxt._visible = false;
}
}; |
|
|
|
|
|
|
|

楼主 |
发表于 30-5-2006 04:57 PM
|
显示全部楼层
在Flash里我是 自编 自导 自演 的没有人教过我
也不是毕业以美术系的
要不是你 我也不知我的写法 是 Flash4 的
超级-番茄 你有开补习班吗? 相信这里有很多人要报名的
[ 本帖最后由 旌洋-君 于 30-5-2006 05:00 PM 编辑 ] |
|
|
|
|
|
|
|
发表于 30-5-2006 06:31 PM
|
显示全部楼层
馬來西亞應該也沒專業的教學吧,大家都是自學的。
Flash我只是業餘打法興趣之一,而且我也沒甚麽耐性教人,我比較鼓勵自立自學 |
|
|
|
|
|
|
|
发表于 30-5-2006 09:03 PM
|
显示全部楼层
原帖由 super-tomato 于 30-5-2006 06:31 PM 发表
馬來西亞應該也沒專業的教學吧,大家都是自學的。
Flash我只是業餘打法興趣之一,而且我也沒甚麽耐性教人,我比較鼓勵自立自學
那么你的专行是什么? |
|
|
|
|
|
|
| |
本周最热论坛帖子
|