メイン コーダーズルーム【スクリプト系】 releaseされたら、消去したい | 投稿するにはまず登録を |
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | 下へ |
投稿者 | スレッド |
---|---|
naanbk | Åê¹ÆNo.2296 投稿日時: 2003-12-19 14:26 |
新米 居住地: 投稿: 2
使用環境:
|
releaseされたら、消去したい はじめまして
Win XP Flash MXの環境です。 メニュー枠が広がる展開型メニューで マウスリリース時にサブメニューを非表示にしたいのです。 大元のボタンクラスをこのように定義して↓ ButtonClass = function(){} obj = ButtonClass.prototype = new MovieClip(); obj.onLoad = function(){ this.init(); } obj.init = function(){ this.func = true; this.behave = "up"; } obj.onRollOver = obj.onDragOver = function(){ if ( this.func ){ this.behave = "over"; this.gotoAndPlay("over"); this.overFunc(); } } obj.onRollOut = obj.onDragOut = obj.onReleaseOutside = function(){ if ( this.func ){ this.behave = "out"; this.gotoAndPlay("out"); this.outFunc(); } } obj.onPress = function(){ if ( this.func ){ this.behave = "press"; this.gotoAndPlay("press"); this.pressFunc(); } } obj.onRelease = function(){ if ( this.func ){ this.behave = "release"; this.gotoAndPlay("release"); this.releaseFunc(); } } obj.setFunc = function( b ){ this.func = b; this.useHandCursor = b; } サブメニューではボタンクラスを継承して SubmenubtnClass = function(){} SubmenubtnClass.prototype = new ButtonClass(); SubmenubtnClass.prototype.releaseFunc = function(){ this._parent.submenu_mc.removeMovieClip(); for ( var pName in this._parent ){ if ( this != this._parent[pName] && this._parent[pName].id == this.id ){ this._parent[pName].endheight = this.closeheight; if ( this._parent[pName].behave == "release" ){ this._parent[pName].setFunc( true ); this._parent[pName].onRelease(); } } } this.setFunc( false ); this.endheight = this.openheight; } と、このようにやってみたのですけど上手くいきません。 どうか、ご教授ください、お願いします。 |
youich | Åê¹ÆNo.2301 投稿日時: 2003-12-19 17:33 |
職人 居住地: kobe 投稿: 349
使用環境:
Tiger |
Re: releaseされたら、消去したい SubmenubtnClassのreleaseFuncはちゃんと呼ばれるみたいですけど、
それ以降↓がうまくいかないんですか? for(var pName in ? しかしそれ以降はこれでは解らないです。
|
naanbk | Åê¹ÆNo.2372 投稿日時: 2003-12-22 14:01 |
新米 居住地: 投稿: 2
使用環境:
|
Re: releaseされたら、消去したい youichさん、ありがとうございます。
SubmenubtnClassのreleaseFuncはちゃんと呼ばれるみたい と、言って頂き、少し元気になりました サブメニューがreleaseされたら消去したいので CategoryBtnClassはいじらなくていいのかな?? と思っていたんですけど、大変恐縮ですが CategoryBtnClassもみてもらっていいですか?? ↓ CategoryBtnClass = function(){} CategoryBtnClass.prototype = new ButtonClass(); CategoryBtnClass.prototype.onEnterFrame = function(){ this.changeHeight(); } CategoryBtnClass.prototype.init = function(){ super.init(); this.id = "categorybtn"; this.num = this._name.substr(1,2)*1; this.openheight = 300; this.closeheight = 30; this.endheight = this.closeheight; } CategoryBtnClass.prototype.changeHeight = function(){ var h = this.endheight - this._height; if ( Math.abs(h)>0.2 ){ this._height += h / 5; } else if ( this._height != this.endheight ){ this._height = this.endheight; this.addSubmenu(); } this._y = this._parent["b"+(this.num-1)]._y + this._parent["b"+(this.num-1)]._height; this._parent["c"+this.num].changePosition( this._y ); } CategoryBtnClass.prototype.pressFunc = function(){ this._parent.submenu_mc.removeMovieClip(); for ( var pName in this._parent ){ if ( this != this._parent[pName] && this._parent[pName].id == this.id ){ this._parent[pName].endheight = this.closeheight; if ( this._parent[pName].behave == "press" ){ this._parent[pName].setFunc( true ); this._parent[pName].onRelease(); } } } this.setFunc( false ); this.endheight = this.openheight; } CategoryBtnClass.prototype.addSubmenu = function(){ if ( this.behave == "press" ){ this._parent.attachMovie("submenu_mc" , "submenu_mc" , 0 , { _y:this._y , num:this.num }); } } 初心者のくせにレベルが高い挑戦のようで 質問事項もうまく伝えることができないのですけど、 ぜひとも、完成させたいのでお願いします。 |
youich | Åê¹ÆNo.2397 投稿日時: 2003-12-22 21:04 |
職人 居住地: kobe 投稿: 349
使用環境:
Tiger |
Re: releaseされたら、消去したい 引用:
??今まで呼ばれなかったですか? SubmenubtnClassのリリース時に _parentにsubmenu_mcが存在していれば消えると思いますよ。 引用:
なんとなく動作の想像はできますが、CategoryBtnClassを いじる必要があるかどうかとかは、もうしわけないですけど、ちょっと想像つかないです。
|
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | トップ |
投稿するにはまず登録を | |