关于AS3的一些问题,高手进

as3 按钮通过xml文件从外部添加链接网址后,想用其中一个按钮链接swf文件,出现错误。请高手帮忙~非常感谢!
40fanluying]
as3 按钮通过xml文件从外部添加链接网址后,想用其中一个按钮链接swf文件,出现错误。请高手帮忙~非常感谢!
40fanluying]
发布时间: 9:21:23
编辑:www.fx114.net
本篇文章主要介绍了"as3 按钮通过xml文件从外部添加链接网址后,想用其中一个按钮链接swf文件,出现错误。请高手帮忙~非常感谢!
40fanluying]",主要涉及到as3 按钮通过xml文件从外部添加链接网址后,想用其中一个按钮链接swf文件,出现错误。请高手帮忙~非常感谢!
40fanluying]方面的内容,对于as3 按钮通过xml文件从外部添加链接网址后,想用其中一个按钮链接swf文件,出现错误。请高手帮忙~非常感谢!
40fanluying]感兴趣的同学可以参考一下。
第一步:新建AS3文件,保存,命名为LinkBtn.fla
第二步:在舞台上建立三个按钮,分别取实例名为&btn1&btn2&btn3
第三步:为LinkBtn.fla指定文档类为&LinkBtn,并保存
第四步:建立LinkBtn.as文件,与LinkBtn.fla保存在同一目录,键入如下代码
JScript&codepackage&&{
&&&&import&flash.display.S
&&&&import&flash.events.E
&&&&import&flash.display.SimpleB
&&&&import&flash.net.URLL
&&&&import&flash.events.IOErrorE
&&&&import&flash.events.SecurityErrorE
&&&&import&flash.net.URLR
&&&&import&flash.events.MouseE
&&&&import&flash.net.navigateToURL;
&&&&public&class&LinkBtn&extends&Sprite&{
&&&&&&&&private&var&_btn1:SimpleB
&&&&&&&&private&var&_btn2:SimpleB
&&&&&&&&private&var&_btn3:SimpleB
&&&&&&&&private&var&_link:XML;
&&&&&&&&public&function&LinkBtn()&{
&&&&&&&&&&&&this.addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
&&&&&&&&private&function&onAddedToStage(e:Event):void{
&&&&&&&&&&&&this._btn1&=&this.getChildByName("btn1")&as&SimpleB
&&&&&&&&&&&&this._btn2&=&this.getChildByName("btn2")&as&SimpleB
&&&&&&&&&&&&this._btn3&=&this.getChildByName("btn3")&as&SimpleB
&&&&&&&&&&&&this._btn1.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&&&&&&&&&this._btn2.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&&&&&&&&&this._btn3.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&&&&&&&&&
&&&&&&&&&&&&var&uloader:URLLoader&=&new&URLLoader();
&&&&&&&&&&&&uloader.PLETE,onComplete);
&&&&&&&&&&&&uloader.addEventListener(IOErrorEvent.IO_ERROR,onIOError);
&&&&&&&&&&&&uloader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,onSeError);
&&&&&&&&&&&&uloader.load(new&URLRequest("LinkBtn.xml"));
&&&&&&&&private&function&onComplete(e:Event):void{
&&&&&&&&&&&&try{
&&&&&&&&&&&&&&&&this._link&=&new&XML(e.target.data);
&&&&&&&&&&&&}catch(err:Error){
&&&&&&&&&&&&&&&&trace("LinkBtn.xml&格式错误");
&&&&&&&&&&&&}
&&&&&&&&private&function&onIOError(e:IOErrorEvent):void{
&&&&&&&&&&&&trace("LinkBtn.xml&文件不存在");
&&&&&&&&private&function&onSeError(e:SecurityErrorEvent):void{
&&&&&&&&&&&&trace("安全冲突,无法加载&LinkBtn.xml");
&&&&&&&&private&function&btnOnClick(e:MouseEvent):void{
&&&&&&&&&&&&var&btn:SimpleButton&=&SimpleButton(e.target);
&&&&&&&&&&&&if(this._link){
&&&&&&&&&&&&&&&&var&tmp:XMLList&=&this._link.child(btn.name);
&&&&&&&&&&&&&&&&if(tmp.length()&0&&&&tmp[0].text()&!=&""){
&&&&&&&&&&&&&&&&&&&&flash.net.navigateToURL(new&URLRequest(tmp[0].text()),"_blank");
&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&}
第五步:建立LinkBtn.xml文件,与Flas***件保存在同一目录,内容如下
XML&code&LinkBtn&
&&&&&btn1&http://community.csdn.net/&/btn1&
&&&&&btn2&.hk&/btn2&
&&&&&btn3&&/btn3&
&/LinkBtn&
非常感谢csdn里diffmaker高手的代码,我想在其中一个按钮点击链接外部的swf文件,如果我是在空白fla文件里添加按钮,为其动作里敲入以下代码:
this._btn.addEventListener(MouseEvent.CLICK,onclick);
function&onclick(e:MouseEvent){
var&picloader:Loader=new&Loader();
var&picfile:URLRequest=new&URLRequest("logo.swf");
picloader.load(picfile);
picloader.contentLoaderInfo.PLETE,&picloaded);
picloader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,picloaderror);
function&picloaded(e:Event){
&this.addChild(e.target.loader);
function&picloaderror(e:IOErrorEvent){
&trace("lost")
点击按钮可以链接外部swf文件,但是,我要是在参照上面代码做好多个按钮以后就会出现:
编辑器错误:场景1,图层‘按钮’帧1,3行&1046找不到类型,或者他不是编译时常数:Loader.
场景1,图层‘按钮’帧1,3行&1180调用的方法可能未定义。
LinkBtn.as&1180:调用的方法addFrameScript可能未定义。
把&import&flash.display.S
换成&import&flash.display.MovieClip&又有了新的错误&&
明明是在btn_里添加动作的,添加后自己跑到多个按钮层上加代码,很奇怪。请教各位高手~非常感谢!import&flash.display.L
少这个。编辑器错误:场景1,图层‘按钮’帧1,3行&1046找不到类型,或者他不是编译时常数:Loader.
场景1,图层‘按钮’帧1,3行&1180调用的方法可能未定义。
LinkBtn.as&1180:调用的方法addFrameScript可能未定义。
你使用了Loader类,那么就需要导入它:import&flash.display.Loader
另外,使用文档类后,最好不要再在帧上添加动作,在文档类中添加。
至于文档类继承Sprite还是MovieClip,要看你的Flas***件有多少帧(主时间轴),若只有一帧,用Sprite,多帧则用MovieClip,Sprite属于轻量级,占用资源要少。你使用了Loader类,那么就需要导入它:import&flash.display.Loader
另外,使用文档类后,最好不要再在帧上添加……
嗯。在原来实现了按钮从外部xml文件超链接网址后,我在&LinkBtn.as中的代码改成了以下代码,虽然没有报错,但是_btn实现不了点击链接.swf文件。不知道哪里出了问题,请教高手们~非常感谢~!
package&&{
&&&&import&flash.display.MovieC
&&&&import&flash.events.E
&&&&import&flash.display.SimpleB
&&&&import&flash.net.URLL
&&&&import&flash.events.IOErrorE
&&&&import&flash.events.SecurityErrorE
&&&&import&flash.net.URLR
&&&&import&flash.events.MouseE
&&&&import&flash.net.navigateToURL;
&&&&import&flash.display.Loader
&&&&&&public&class&LinkBtn&extends&MovieClip{
&&&&&&&&private&var&_btn1:SimpleB
&&&&&&&&private&var&_btn2:SimpleB
&&&&&&&&private&var&_btn3:SimpleB
&&&&private&var&_btn4:SimpleB
//private&var&_btn5:SimpleB
private&var&_btn6:SimpleB
&&&&&&&&private&var&_btn7:SimpleB
&&&&private&var&_btn8:SimpleB
private&var&_btn9:SimpleB
&&&&&&&&private&var&_link:XML;
&&&&&&&&public&function&LinkBtn()&{
&&&&&&&&&&&&this.addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
//以下红色这段是我添加_btn按钮想要实现的功能
&private&function&anniu(e:MouseEvent):void{
&this._btn.addEventListener(MouseEvent.CLICK,onclick);
&&&&&&&&&function&onclick(e:MouseEvent){
&&&&&&&&&var&picloader:Loader=new&Loader();
&&&&&&&&var&picfile:URLRequest=new&URLRequest("logo.swf");
&&&&&&&&&picloader.load(picfile);
&&&&&&&&picloader.contentLoaderInfo.PLETE,&picloaded);
&&&&&&&&picloader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,picloaderror);
&&&&&&&&&}
&&&&&&&&&function&picloaded(e:Event){
&&&&&&&&&&this.addChild(e.target.loader);
&&&&&&&&&}
&&&&&&&&&function&picloaderror(e:IOErrorEvent){
&&&&&&&&&&trace("lost")
&&&&&&&&&}
&&&&&&&&private&function&onAddedToStage(e:Event):void{
&&&&&&&&&&&&this._btn1&=&this.getChildByName("btn1")&as&SimpleB
&&&&&&&&&&&&this._btn2&=&this.getChildByName("btn2")&as&SimpleB
&&&&&&&&&&&&this._btn3&=&this.getChildByName("btn3")&as&SimpleB
&&&&this._btn4&=&this.getChildByName("btn4")&as&SimpleB
&&&&//this._btn5&=&this.getChildByName("btn5")&as&SimpleB
&&&&this._btn6&=&this.getChildByName("btn6")&as&SimpleB
&&&&this._btn7&=&this.getChildByName("btn7")&as&SimpleB
&&&&this._btn8&=&this.getChildByName("btn8")&as&SimpleB
&&&&this._btn9&=&this.getChildByName("btn9")&as&SimpleB
&&&&&&&&&&&&this._btn1.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&&&&&&&&&this._btn2.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&&&&&&&&&this._btn3.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&this._btn4.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&//this._btn5.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&&&&&&&&&this._btn6.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&&&&&&&&&this._btn7.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&this._btn8.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&this._btn9.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&&&&&&&&&var&uloader:URLLoader&=&new&URLLoader();
&&&&&&&&&&&&uloader.PLETE,onComplete);
&&&&&&&&&&&&uloader.addEventListener(IOErrorEvent.IO_ERROR,onIOError);
&&&&&&&&&&&&uloader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,onSeError);
&&&&&&&&&&&&uloader.load(new&URLRequest("LinkBtn.xml"));
&&&&&&&&private&function&onComplete(e:Event):void{
&&&&&&&&&&&&try{
&&&&&&&&&&&&&&&&this._link&=&new&XML(e.target.data);
&&&&&&&&&&&&}catch(err:Error){
&&&&&&&&&&&&&&&&trace("LinkBtn.xml&格式错误");
&&&&&&&&&&&&}
&&&&&&&&private&function&onIOError(e:IOErrorEvent):void{
&&&&&&&&&&&&trace("LinkBtn.xml&文件不存在");
&&&&&&&&private&function&onSeError(e:SecurityErrorEvent):void{
&&&&&&&&&&&&trace("安全冲突,无法加载&LinkBtn.xml");
&&&&&&&&private&function&btnOnClick(e:MouseEvent):void{
&&&&&&&&&&&&var&btn:SimpleButton&=&SimpleButton(e.target);
&&&&&&&&&&&&if(this._link){
&&&&&&&&&&&&&&&&var&tmp:XMLList&=&this._link.child(btn.name);
&&&&&&&&&&&&&&&&if(tmp.length()&0&&&&tmp[0].text()&!=&""){
&&&&&&&&&&&&&&&&&&&&flash.net.navigateToURL(new&URLRequest(tmp[0].text()),"_blank");
&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&}
}引用&2&楼&&的回复:编辑器错误:场景1,图层‘按钮’帧1,3行&1046找不到类型,或者他不是编译时常数:Loader.
场景1,图层‘按钮’帧1,3行&1180调用的方法可能未定义。
LinkBtn.as&1180:调用的方法addFrameScript可能未定义。
你使用了Loader类,那么就需要导入它:import&flash.display.Loader
另外,使用文档类后,最好不要再在帧上添加……
嗯。在原来实现了按钮从外部xml文件超链接网址后,我在&LinkBtn.as中的代码改成了以下代码,虽然没有报错,但是_btn实现不了点击链接.swf文件。不知道哪里出了问题,请教高手们~非常感谢~!
&&import&flash.display.MovieC
&&import&flash.events.E
&&import&flash.display.SimpleB
&&import&flash.net.URLL
&&import&flash.events.IOErrorE
&&import&flash.events.SecurityErrorE
&&import&flash.net.URLR
&&import&flash.events.MouseE
&&import&flash.net.navigateToURL;
&&import&flash.display.Loader
&&public&class&LinkBtn&extends&MovieClip{
&&private&var&_btn1:SimpleB
&&private&var&_btn2:SimpleB
&&private&var&_btn3:SimpleB
private&var&_btn4:SimpleB
//private&var&_btn5:SimpleB
private&var&_btn6:SimpleB
&&private&var&_btn7:SimpleB
private&var&_btn8:SimpleB
private&var&_btn9:SimpleB
&&private&var&_link:XML;
&&public&function&LinkBtn()&{
&&this.addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
//以下红色这段是我添加_btn按钮想要实现的功能
private&function&anniu(e:MouseEvent):void{
this._btn.addEventListener(MouseEvent.CLICK,onclick);
function&onclick(e:MouseEvent){
var&picloader:Loader=new&Loader();
var&picfile:URLRequest=new&URLRequest("logo.swf");
picloader.load(picfile);
picloader.contentLoaderInfo.PLETE,&picloaded);
picloader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,picloaderror);
function&picloaded(e:Event){
this.addChild(e.target.loader);
function&picloaderror(e:IOErrorEvent){
trace("lost")
&&private&function&onAddedToStage(e:Event):void{
&&this._btn1&=&this.getChildByName("btn1")&as&SimpleB
&&this._btn2&=&this.getChildByName("btn2")&as&SimpleB
&&this._btn3&=&this.getChildByName("btn3")&as&SimpleB
this._btn4&=&this.getChildByName("btn4")&as&SimpleB
//this._btn5&=&this.getChildByName("btn5")&as&SimpleB
this._btn6&=&this.getChildByName("btn6")&as&SimpleB
this._btn7&=&this.getChildByName("btn7")&as&SimpleB
this._btn8&=&this.getChildByName("btn8")&as&SimpleB
this._btn9&=&this.getChildByName("btn9")&as&SimpleB
&&this._btn1.addEventListener(MouseEvent.CLICK,btnOnClick);
&&this._btn2.addEventListener(MouseEvent.CLICK,btnOnClick);
&&this._btn3.addEventListener(MouseEvent.CLICK,btnOnClick);
this._btn4.addEventListener(MouseEvent.CLICK,btnOnClick);
//this._btn5.addEventListener(MouseEvent.CLICK,btnOnClick);
&&this._btn6.addEventListener(MouseEvent.CLICK,btnOnClick);
&&this._btn7.addEventListener(MouseEvent.CLICK,btnOnClick);
this._btn8.addEventListener(MouseEvent.CLICK,btnOnClick);
this._btn9.addEventListener(MouseEvent.CLICK,btnOnClick);
&&var&uloader:URLLoader&=&new&URLLoader();
&&uloader.PLETE,onComplete);
&&uloader.addEventListener(IOErrorEvent.IO_ERROR,onIOError);
&&uloader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,onSeError);
&&uloader.load(new&URLRequest("LinkBtn.xml"));
&&private&function&onComplete(e:Event):void{
&&this._link&=&new&XML(e.target.data);
&&}catch(err:Error){
&&trace("LinkBtn.xml&格式错误");
&&private&function&onIOError(e:IOErrorEvent):void{
&&trace("LinkBtn.xml&文件不存在");
&&private&function&onSeError(e:SecurityErrorEvent):void{
&&trace("安全冲突,无法加载&LinkBtn.xml");
&&private&function&btnOnClick(e:MouseEvent):void{
&&var&btn:SimpleButton&=&SimpleButton(e.target);
&&if(this._link){
&&var&tmp:XMLList&=&this._link.child(btn.name);
&&if(tmp.length()&0&&&&tmp[0].text()&!=&""){
&&flash.net.navigateToURL(new&URLRequest(tmp[0].text()),"_blank");
}private&function&anniu(e:MouseEvent):void{
this._btn.addEventListener(MouseEvent.CLICK,onclick);
function&onclick(e:MouseEvent){
var&picloader:Loader=new&Loader();
var&picfile:URLRequest=new&URLRequest("logo.swf");
picloader.load(picfile);
picloader.contentLoaderInfo.PLETE,&picloaded);
picloader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,picloaderror);
function&picloaded(e:Event){
this.addChild(e.target.loader);
function&picloaderror(e:IOErrorEvent){
trace("lost")
你为什么要嵌套使用函数?最外层的anniu函数就没有执行吧?也就没有为this._btn绑定事件,当然你点击它什么都不会执行啦。引用&5&楼&&的回复:JScript&code
private&function&anniu(e:MouseEvent):void{
this._btn.addEventListener(MouseEvent.CLICK,onclick);
function&onclick(e:MouseEvent){
var&picloader:Loader=new&Loader();
var&picfile:URLReq……
那怎么解决啊????怎么才能让这个按钮执行点击后链接swf文件?代码直接放在package外面也行不通啊,因为我在单独做一个按钮的时候是在帧上写的动作,是可以成功执行的。但是在类里嵌套不行的话,在package外也不行。
this._btn.addEventListener(MouseEvent.CLICK,onclick);
&&&&&&&&&function&onclick(e:MouseEvent){
&&&&&&&&&var&picloader:Loader=new&Loader();
&&&&&&&&var&picfile:URLRequest=new&URLRequest("logo.swf");
&&&&&&&&&picloader.load(picfile);
&&&&&&&&picloader.contentLoaderInfo.PLETE,&picloaded);
&&&&&&&&picloader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,picloaderror);
&&&&&&&&&}
&&&&&&&&&function&picloaded(e:Event){
&&&&&&&&&&this.addChild(e.target.loader);
&&&&&&&&&}
&&&&&&&&&function&picloaderror(e:IOErrorEvent){
&&&&&&&&&&trace("lost")
&&&&&&&&&}
package&&{
import&flash.display.MovieC
&&&&import&flash.events.E
&&&&import&flash.display.SimpleB
&&&&import&flash.net.URLL
&&&&import&flash.events.IOErrorE
&&&&import&flash.events.SecurityErrorE
&&&&import&flash.net.URLR
&&&&import&flash.events.MouseE
&&&&import&flash.net.navigateToURL;
&&&&import&flash.display.Loader
&&&&&&public&class&LinkBtn&extends&MovieClip{
&&&&&&&&private&var&_btn1:SimpleB
&&&&&&&&private&var&_btn2:SimpleB
&&&&&&&&private&var&_btn3:SimpleB
&&&&private&var&_btn4:SimpleB
//private&var&_btn5:SimpleB
private&var&_btn6:SimpleB
&&&&&&&&private&var&_btn7:SimpleB
&&&&private&var&_btn8:SimpleB
private&var&_btn9:SimpleB
&&&&&&&&private&var&_link:XML;
&&&&&&&&public&function&LinkBtn()&{
&&&&&&&&&&&&this.addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
&&&&&&&&private&function&onAddedToStage(e:Event):void{
&&&&&&&&&&&&this._btn1&=&this.getChildByName("btn1")&as&SimpleB
&&&&&&&&&&&&this._btn2&=&this.getChildByName("btn2")&as&SimpleB
&&&&&&&&&&&&this._btn3&=&this.getChildByName("btn3")&as&SimpleB
this._btn4&=&this.getChildByName("btn4")&as&SimpleB
//this._btn5&=&this.getChildByName("btn5")&as&SimpleB
this._btn6&=&this.getChildByName("btn6")&as&SimpleB
this._btn7&=&this.getChildByName("btn7")&as&SimpleB
this._btn8&=&this.getChildByName("btn8")&as&SimpleB
this._btn9&=&this.getChildByName("btn9")&as&SimpleB
&&&&&&&&&&&&this._btn1.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&&&&&&&&&this._btn2.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&&&&&&&&&this._btn3.addEventListener(MouseEvent.CLICK,btnOnClick);
this._btn4.addEventListener(MouseEvent.CLICK,btnOnClick);
//this._btn5.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&&&&&&&&&this._btn6.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&&&&&&&&&this._btn7.addEventListener(MouseEvent.CLICK,btnOnClick);
this._btn8.addEventListener(MouseEvent.CLICK,btnOnClick);
this._btn9.addEventListener(MouseEvent.CLICK,btnOnClick);
&&&&&&&&&&&&var&uloader:URLLoader&=&new&URLLoader();
&&&&&&&&&&&&uloader.PLETE,onComplete);
&&&&&&&&&&&&uloader.addEventListener(IOErrorEvent.IO_ERROR,onIOError);
&&&&&&&&&&&&uloader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,onSeError);
&&&&&&&&&&&&uloader.load(new&URLRequest("LinkBtn.xml"));
&&&&&&&&private&function&onComplete(e:Event):void{
&&&&&&&&&&&&try{
&&&&&&&&&&&&&&&&this._link&=&new&XML(e.target.data);
&&&&&&&&&&&&}catch(err:Error){
&&&&&&&&&&&&&&&&trace("LinkBtn.xml&格式错误");
&&&&&&&&&&&&}
&&&&&&&&private&function&onIOError(e:IOErrorEvent):void{
&&&&&&&&&&&&trace("LinkBtn.xml&文件不存在");
&&&&&&&&private&function&onSeError(e:SecurityErrorEvent):void{
&&&&&&&&&&&&trace("安全冲突,无法加载&LinkBtn.xml");
&&&&&&&&private&function&btnOnClick(e:MouseEvent):void{
&&&&&&&&&&&&var&btn:SimpleButton&=&SimpleButton(e.target);
&&&&&&&&&&&&if(this._link){
&&&&&&&&&&&&&&&&var&tmp:XMLList&=&this._link.child(btn.name);
&&&&&&&&&&&&&&&&if(tmp.length()&0&&&&tmp[0].text()&!=&""){
&&&&&&&&&&&&&&&&&&&&flash.net.navigateToURL(new&URLRequest(tmp[0].text()),"_blank");
&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&}
&&&求高手解答啊,谢谢谢谢谢谢谢谢~引用&5&楼&&的回复:JScript&code
private&function&anniu(e:MouseEvent):void{
this._btn.addEventListener(MouseEvent.CLICK,onclick);
function&onclick(e:MouseEvent){
var&picloader:Loader=new&Loader();
var&picfile:URLReq……
呵呵,可以了,我把package去掉就ok了,按钮正常链接网址,也正常打开swf文件。非常感谢!
本文标题:
本页链接:已被0人收藏
&css+div高手进来!问个问题!
来自:保密
发帖:243+4291
-------------------------------------------------------------------------------------------
x800还是太慢啊!过渡产品。。。
来自:保密
发帖:243+4292
[img]http://img.club.pchome.net/html/images//img/shu1.gif[/img]
&主题内容&
[img]http://img.club.pchome.net/html/images//img/shu2.gif[/img]
这是pchome的主题内容的按钮做法,为什么也是用table...
难道不能用div+css来实现?
-------------------------------------------------------------------------------------------
x800还是太慢啊!过渡产品。。。
来自:保密
发帖:243+4293
高手在那里?
-------------------------------------------------------------------------------------------
x800还是太慢啊!过渡产品。。。
来自:保密
发帖:202+1661
为什么要用div?
-------------------------------------------------------------------------------------------
这个家伙很懒,什么也没留下......
来自:保密
发帖:26+1393
http://www.w3cn.org/article/translate/.html
获网友奖分20点 &
-------------------------------------------------------------------------------------------
○ → ◇ → □ → △ → ☆ → ultraseven
来自:保密
发帖:243+4294
页面中不让出现table..
我又不高兴直接用一张图片去处理掉这个细节.
-------------------------------------------------------------------------------------------
x800还是太慢啊!过渡产品。。。
来自:保密
发帖:26+1394
上面的那篇不够你用吗?,,,
-------------------------------------------------------------------------------------------
○ → ◇ → □ → △ → ☆ → ultraseven
来自:保密
发帖:243+4295
上面那篇太麻烦,看不懂..
我只要实现这个table能实现的就行了,代码越精简越好.
-------------------------------------------------------------------------------------------
x800还是太慢啊!过渡产品。。。
来自:保密
发帖:26+1395
拿这个抄一下改一下就是了呀
http://www.w3cn.org/article/translate/.html
body { background:# margin:0; padding:0; color:#000; font:x-small/1.5em Georgia,S voice-family: \"\\\"}\\\"\"; voice-family: font-size: } html>body {font-size:} #header { float: width:100%; background:#DAE0D2 url(\"bg.gif\") repeat- font-size:93%; line-height: } #header ul { margin:0; padding:10px 10px 0; list-style: } #header li { float: background:url(\"left.gif\") no- margin:0; padding:0 0 0 9 } #header a { float: display: background:url(\"right.gif\") no- padding:5px 15px 4px 6 text-decoration: font-weight: color:#765; } /* Commented Backslash Hack hides rule from IE5-Mac \\*/ #header a {float:} /* End IE5-Mac hack */ #header a:hover { color:#333; } #header #current { background-image:url(\"left_on.gif\"); } #header #current a { background-image:url(\"right_on.gif\"); color:#333; padding-bottom:5 }
Home News Products About Contact
-------------------------------------------------------------------------------------------
○ → ◇ → □ → △ → ☆ → ultraseven
来自:保密
发帖:243+4296
我希望的是这个按钮根据他外面的框的大小自动的拉伸到100%
用table可以轻松做到,但用div 把css里设成width=100%好像不行。
-------------------------------------------------------------------------------------------
x800还是太慢啊!过渡产品。。。
来自:保密
发帖:0+427
回楼主,我认为这个按钮完全没有必要套div实现。
div+css布局的本意就是让每个标签含义所代表的元素回归它的本意。好比table的本意是用于数据展示,而根本不是用来页面布局。
但是div元素它是用于容器的实现的。8楼指出的方向是正确的,用实现。在css样式表中为指定好背景图象就好了。(其实css高手可以直接借助css画出任何形状图形)。你的拉伸是指你在DW中拉伸?还是指按钮背景可以根据分辨率的不同扩张?
如果是前者的意思,那你在制作之前应该把每个部分的尺寸什么的都设计规划好才对。根据样图来设计页面。这也是目前的工作规范。
-------------------------------------------------------------------------------------------
懂得当中的分别吗?有些事情,已再不能被称为想念了,只是记起、记起而已。
来自:保密
发帖:243+4298
我是指按钮背景可以根据分辨率的不同扩张?
我希望能不管宽屏和普屏都能达到满屏。
-------------------------------------------------------------------------------------------
x800还是太慢啊!过渡产品。。。
来自:保密
发帖:0+428
如果背景是单一色矩形状那就用直接给li设置背景色。li与父层的大小一率用百分比,li也就自然扩张了。
如果要宽带山的按钮效果,直接用它的方法不好吗,左右各一张图,中间背景色。你偏不用图片的话,怕是有些浏览器也不完全支持CSS2.0。
#container { position: } #menu { text-align: position: height:8 } .box { position: float: top:30 } #menu a, #menu a:visited { position: text-decoration: background-color:#06a; color:# display: width:70 height:15 padding:5 margin:0 1 } #menu a .topleft, #menu a .topright { position: top:0; width:0; height:0; overflow: border-top:10px solid # } #menu a .topleft { left:0; border-right:10px solid #06a; } #menu a .topright { left:70 border-left:10px solid #06a; } #menu a:hover { background-color:#000; } #menu a:hover .topleft { border-right:10px solid #000; border-top:10px solid # } #menu a:hover .topright { border-left:10px solid #000; border-top:10px solid # } Item 1
-------------------------------------------------------------------------------------------
懂得当中的分别吗?有些事情,已再不能被称为想念了,只是记起、记起而已。
来自:保密
发帖:0+429
代码有些地方该改成%的就自己改吧
-------------------------------------------------------------------------------------------
懂得当中的分别吗?有些事情,已再不能被称为想念了,只是记起、记起而已。
来自:保密
发帖:0+430
此代码只经过firefox下测试
-------------------------------------------------------------------------------------------
懂得当中的分别吗?有些事情,已再不能被称为想念了,只是记起、记起而已。
来自:保密
发帖:547+10433
都快淘汰了,表用了
(只在.net方面)未来的UI趋势是wpf。软件和web 2.0网站之间的区别将被消灭
其他方面,flash 9的as3很有发展潜力
美工做好的illustrater可以直接调用。
-------------------------------------------------------------------------------------------
18-200 vrii我来娶你拉
来自:保密
发帖:0+431
请教15楼的方法,不要空口说大话哦
-------------------------------------------------------------------------------------------
懂得当中的分别吗?有些事情,已再不能被称为想念了,只是记起、记起而已。
来自:保密
发帖:0+432
不过我也蛮看好as3的,只是flash 9 preview出来了这么久,国外也出了两本书,估计要等9.0正式版出来,as 3开始推广,至少也07年低以后的事情。
-------------------------------------------------------------------------------------------
懂得当中的分别吗?有些事情,已再不能被称为想念了,只是记起、记起而已。
来自:保密
发帖:547+10435
用js做ui,做个google,msn浮动层效果,***设置了太多,内容一多就慢死。
div里面内容塞了多了,firefox,safari还好说,效率高。遇到ie6还好混混,垃圾ie7里面不谈了
dhtml迟早要淘汰了,由于web 2.0,js承受了太重的负担了,已经太古老的技术了。没debug,没ide,纯粹靠手工编码和调试。
今明2年发展趋势就是软件和网站融合,至少微软的.net 3.0的发展趋势是这个。为了实现这个就要推出新的ui系统。微软的解决方案是推广wpf和浏览器方面的wpf/e。最大对手就是史无前例强大的flash9,其中的as3效率之高是as2不能企及的。
-------------------------------------------------------------------------------------------
18-200 vrii我来娶你拉
来自:保密
发帖:1+82
-------------------------------------------------------------------------------------------
这个家伙很懒,什么也没留下......
来自:保密
发帖:1+83
去blueidea吧
-------------------------------------------------------------------------------------------
这个家伙很懒,什么也没留下......
来自:保密
发帖:0+433
你讲的那些我也听说过了。只是你一开头那句“表用了,快淘汰了”让人觉得奇怪。IT里的哪样技术不是准备被淘汰呢?目前什么方案性价比最高就用什么。XHTML+CSS在当下几年内一定还是最优选。JS与其套用也不冲突。至于FLASH 9的,我觉得非常好。可你知道吗,国内很多客户都不同意输出FLASH 8。AS 2是绝对该淘汰的。可是大家都很为难地要用它。
C‘est la vie!
-------------------------------------------------------------------------------------------
懂得当中的分别吗?有些事情,已再不能被称为想念了,只是记起、记起而已。
来自:保密
发帖:243+4299
受教了。。
看来没必要非用css+div...
只要效果出来就行了……
有点叫真了,是不?
-------------------------------------------------------------------------------------------
x800还是太慢啊!过渡产品。。。
来自:保密
发帖:0+74
-------------------------------------------------------------------------------------------
这个家伙很懒,什么也没留下......
首先,请你以一种,团成一个团的姿势,然后,慢慢地比较圆润的方式,离开这座让你讨厌的城市,或者讨厌的人的周围首先,请你以一种,团成一个团的姿势,然后,慢慢地比较圆润的方式,离开这座让你讨厌的城市,或者讨厌的人的周围
css+div高手进来!问个问题!
扫描关注官方微信
扫描下载客户端
你可以发私信给一个或多个听众。默认不能发给非听众,除非对方设置了允许。
奖励分值:您今日还有 3 点分值可以奖励 [ 20 点奖分可自动换取 1 点PP]
请输入4位有相同表情的数字
&违反国家法律&&&&&&&&&含有***内容
&对他人进行恶意攻击
&散布广告以及其它商业化的宣传
&干扰或混乱kds宽带山网络服务
&发布任何包含种族、 性别、宗教歧视性和猥亵性的信息内容
&恶意刷屏&&&&&&&&&&&&&&&内容重复
&本人要求删除&&&&&&&&当事人要求删除
&与主题无关&&&&&&&&&&&水贴软文
&被要求删除,你懂的
扣除hp值:
宽带山警务室
&恶意刷屏&&&&&&&&&水贴软文
&违反国家法律
&含有***内容
&对他人进行恶意攻击
&散布广告以及其它商业化的宣传
&干扰或混乱kds宽带山网络服务
&发布任何包含种族、 性别、宗教歧视性和猥亵性的信息内容
&网页不能打开
&图片不能显示
已报名参加的人员:

参考资料

 

随机推荐