Results 1 to 14 of 14
Thread: AS2 -> AS3 convert please
-
July 3rd, 2008, 10:14 PM #17Registered User
postsAS2 -> AS3 convert please
Hi, can you help me and convert that AS2 code to AS3: http://www.flashframer.com/how-to-cr...vigation-menu/ For you that is 5 minutes, and I'll can see differents.
Thanks
-
July 3rd, 2008, 10:24 PM #2
Oh cmon man .. :/
* [ Flash portfolio ] http://www.erikhallander.com/
* [ Flash blog ] http://www.erikhallander.com/blog/
* [ Work @ ] http://www.visualjazz.com.au
-
July 3rd, 2008, 10:25 PM #3
Umm... how about you have a go at doing it yourself, ask questions if you get stuck and actually learn from the experience? That way you'll have a far more useful transfer of knowledge, as if someone else just does the work for you then you'll only skim the surface of learning.
I mean seriously... if you're not prepared to put any effort in, why should someone else?
-
July 4th, 2008, 02:18 PM #47Registered User
postsok my question is ho can I do something like that with addChild()
_root.attachMovie("button","btn"+i,_root.getNextGi ghestDepth());
"button" is an instance name of my movie clip which I want to use as a button in my menu.
I tried to do something like that:
var button:MovieClip = new MovieClip();
addChild(button).name = "btn"+i;
this.getchildByName("btn"+i).y = y_position;
but I think that is creating a new MovieClip, and I want to use movieClip from library.. with instance name "button"
-
July 4th, 2008, 02:20 PM #5
var b:button = new button();
addChild(b);
b.y = 25;
b.alpha = .7;* [ Flash portfolio ] http://www.erikhallander.com/
* [ Flash blog ] http://www.erikhallander.com/blog/
* [ Work @ ] http://www.visualjazz.com.au
-
July 4th, 2008, 02:29 PM #67Registered User
poststhanks
it's warking
I think that now I can finish my menu
-
July 5th, 2008, 10:04 AM #77Registered User
postshmm one question more. When I have
function xmlLoaded(event:Event):void{
...
for(var i:int = 0; i<xmlList.length(); i++)
...
How can I load variable i in new function?
function btnOver(e:Event):void
{
this.getChildByName("btn"+i).gotoAndPlay(2);
}
-
July 5th, 2008, 10:12 AM #883so confused
postsActionScript Code:
function xmlLoaded(e:Event):void {
var len:Number = xmlList.length();
for(var i:int=0; i<len; ++i) {
somebtn.addEventListener(MouseEvent.MOUSE_OVER, btnOver);
}
}
function btnOver(e:MouseEvent):void
{
e.target.gotoAndPlay(2);
}
Something like this?
-
July 5th, 2008, 10:43 AM #97Registered User
postsI'm trying to convert AS2 to AS3 code from link [top of the page] There are everything to understend "my" code

if I do:
e.target.gotoAndPlay(2);
I have error:
ReferenceError: Error #1069: Property gotoAndPlay not found on flash.text.TextField and there is no default value.
at FF_Navigation_Menu_2_fla::MainTimeline/btnOver()
that is my first AS code..
thanks for helping
-
July 5th, 2008, 10:46 AM #10
do mouseChildren = false on your button since your textfields are sending the event atm.
* [ Flash portfolio ] http://www.erikhallander.com/
* [ Flash blog ] http://www.erikhallander.com/blog/
* [ Work @ ] http://www.visualjazz.com.au
-
July 5th, 2008, 11:02 AM #117Registered User
postshmm, I find something like currentTarget and I see that it's working. Is it good
?
But I'll read about mouseChildren
-
July 5th, 2008, 11:06 AM #1283so confused
postsyes, if "target" doesn't work, using "currentTarget" is perfectly acceptable - there is a distinct difference that I have yet to get clear within my head
-
July 5th, 2008, 11:09 AM #13
target is the object that flash has targeted for the event
currentTarget is the object that is being called by the listener when the event occurs.* [ Flash portfolio ] http://www.erikhallander.com/
* [ Flash blog ] http://www.erikhallander.com/blog/
* [ Work @ ] http://www.visualjazz.com.au
-
July 5th, 2008, 12:29 PM #147Registered User
postsagain You have right :) Can you check this :)?
ActionScript Code:
var y_pozycja:Number = 0;
var nazwy:Array = new Array();
var linki:Array = new Array();
var xml:XML;
var xmlList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("links.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(event:Event):void
{
xml = XML(event.target.data);
xmlList = xml.children();
for(var i:int = 0; i<xmlList.length(); i++)
{
nazwy.push(xmlList[i].@NAME);
linki.push(xmlList[i].@LINK);
var b:button = new button();
addChild(b).name = "btn"+i;
this.getChildByName("btn"+i).y = y_pozycja;
y_pozycja += 25;
this.getChildByName("btn"+i).blackTxt.Txt.text = nazwy[i];
this.getChildByName("btn"+i).whiteTxt.Txt.text = nazwy[i];
this.getChildByName("btn"+i).addEventListener(MouseEvent.MOUSE_OVER,btnOver);
this.getChildByName("btn"+i).addEventListener(MouseEvent.MOUSE_OUT,btnOut);
this.getChildByName("btn"+i).addEventListener(MouseEvent.CLICK,clicked);
this.getChildByName("btn"+i).mouseChildren = false;
}
}
function btnOver(e:MouseEvent):void
{
e.target.gotoAndPlay(2);
}
function btnOut(e:MouseEvent):void
{
e.target.gotoAndPlay(16);
}
function clicked(e:MouseEvent):void
{
var nazwa:String = e.target.name;
var index:String = nazwa.substring(3,5);
var request:URLRequest = new URLRequest(linki[index]);
navigateToURL(request,"_blank");
}
Last edited by krystek1987; July 6th, 2008 at 08:51 AM.

Reply With Quote


Bookmarks