经典论坛's Archiver

recallshan 发表于 2008-7-4 00:24

Flash5 indexof 在Flash8中应用的问题

近日得到一个fla源码是关于用Flash当作系统开机画面的

  fla源码是用flash5编的   因为要用要视频和声音  所以就转flash8

  但是有一段在flash8中就应用错误

   if (_name.indexof("item", 0)<0) {
   
   错误提示  
   
**错误** 符号=Mymenu - win, 图层=items, 帧=2:第 3 行: 没有名为'indexof'的方法。
             if (_name.indexof("item", 0)<0) {

**错误** 符号=Mymenu - win ediable, 图层=items, 帧=2:第 3 行: 没有名为'indexof'的方法。
             if (_name.indexof("item", 0)<0) {


  
  flash8中有没有代码可以替代 flash5中的  indexof  呢?   
   
  还有一个问题就是flash可不可以加载声音驱动  因为xp系统在未登陆用户之前是没有加载声音的

  所以只能靠flash来加载

flash023 发表于 2008-7-4 08:24

if (_name.indexof("item")<0) {

recallshan 发表于 2008-7-4 12:50

谢谢版主  更改了代码虽然不报错了,但还是无效

这个效果是一个下拉菜单  得到计算机用户名和组

以下是报错的那段代码

onClipEvent (load) {
        //  duplicate the top item and assign labels to each new item
        if (_name.indexof("item")<0) {
                //  we are the top item
                _name = "item0";
                label = _parent._parent.items[0];
                //  duplicate to itema
                for (var i = 1; i<(_parent._parent.items.length); i++) {
                        duplicateMovieClip (_target, "item"+i, i);
                }
                //  size & position menu outline
            overlap = 2;
                //_parent.outline._height = 5*(_height - overlap);
                _parent.outline._height = _height + (_parent._parent.items.length - 1)*(_height - overlap);
                _parent.outline._y = _parent.item0._y;
                //  send outline to top of stack
                _parent.outline.swapDepths(100);
        } else {
                //  duplicated items and position at bottom of list
                var index = parseInt(_name.substr(4, 3));
                label = _parent._parent.items[index];
                overlap = 2;
                _y+=index*(_height - overlap);
        }
}
onClipEvent (mouseDown) {
        //  see if we pressed on our menu item
        if (hitTest(_root._xmouse, _root._ymouse, false)) {
                //  call the method before doing a goto(1)
                //  a goto(1) in the parent will cause
                //  this handler to go away
                _parent._parent.OnMenu(parseInt(_name.substr(4, 3)), label);
                _parent._parent.currentValue = _parent["item"+parseInt(_name.substr(4, 3))].label;
                _parent.prevFrame();
                updateAfterEvent();
        } else if (_parent.winshell.hittest(_root._xmouse, _root._ymouse)) {
                _parent.prevFrame();
                updateAfterEvent();
        }
}
onClipEvent (mouseUp) {
        //  check if mouse is still held down over default value
        currentTime = getTimer();
        if (_parent.winshell.hitTest(_root._xmouse, _root._ymouse) && (currentTime - _parent.delayCheck) > 1000) {
                _parent.delayCheck = 0;
                _parent.prevFrame();
                updateAfterEvent();
        } else if (!_parent.winshell.hitTest(_root._xmouse, _root._ymouse)) {
                //  hit test all of the items starting with item1
                for (var i = 0; i<_parent._parent.items.length; i++) {
                        if (_parent["item"+i].hitTest(_root._xmouse, _root._ymouse)) {
                                _parent._parent.OnMenu(i, _parent["item"+i].label);
                                _parent._parent.currentValue = _parent["item"+i].label;
                        }
                }
                //  remember this will cause the unload event
                //  for item0
                _parent.prevFrame();
                updateAfterEvent();
        }
}
onClipEvent (mouseMove) {
        //  set highlight colors if mouse is over us
        if (hitTest(_root._xmouse, _root._ymouse, false)) {
                textColor = new Color(this.textlabel);
                textColor.setRGB(0xFFFFFF);
                bgColor = new Color(this.textbg);
                bgColor.setRGB(0x003366);
        } else {
                //  set colors back to normal if mouse isn't over us
                textColor = new Color(this.textlabel);
                textColor.setRGB(0x000000);
                bgColor = new Color(this.textbg);
                bgColor.setRGB(0xFFFFFF);
        }
        updateAfterEvent();
}
onClipEvent (unload) {
        //  remove outline
        _parent.Outline.removeMovieClip();
        //  make the top item unload all of the other items
        if (_name != "item0") {
                return;
        }
        for (var i = 1; i<(_parent._parent.items.length); i++) {
                _parent["item"+i].removeMovieClip();
        }
}


[b]下面是Flash的源文件[/b]

[url=http://www.namipan.com/d/Luna.fla/3cf525b4550b6b05baa5808f07e3cf0aa973101e008e0300]Luna.fla[/url]

页: [1]



Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.