Search Results

Search found 2 results on 1 pages for 'minelava'.

Page 1/1 | 1 

  • 1067: Implicit coercion of a value of type theplayclass to an unrelated type main

    - by Minelava
    I need help because I want to create a gameover screen that display score. However, there's an error that prevent me from transferring the score from theplayclass.as to thegameoverclass.as. Are there ways to pass a value to another movieclip without causing any errors. I refer the source code from this website : http://www.emanueleferonato.com/2008/12/17/designing-the-structure-of-a-flash-game-as3-version/ Here's the error C:\Users\xxx\Downloads\Migrate\test\theplayclass.as, Line 54, Column 41 1067: Implicit coercion of a value of type theplayclass to an unrelated type main. main.as package { import flash.display.MovieClip; import flash.events.Event; public class main extends MovieClip { public var playClass:theplayclass; public var gameOverClass:thegameoverclass; public function main() { showWin(); } public function showWin() { playClass = new theplayclass(this); addChild(playClass); } public function showGameOver() { gameOverClass = new thegameoverclass(this); addChild(gameOverClass); removeChild(playClass); playClass = null; } } } theplayclass.as package { import flash.display.MovieClip; import flash.events.*; public class theplayclass extends MovieClip { private var mainClass:main; var gameScore:Number; var gameOverScore:thegameoverclass; public function theplayclass(passedClass:main) { mainClass = passedClass; scoreText.text ="0"; gameScore = 0; win.addEventListener(MouseEvent.CLICK, showwinFunction); next.addEventListener(MouseEvent.CLICK, showgameoverFunction); addEventListener(Event.ADDED_TO_STAGE, addToStage); addEventListener(Event.ENTER_FRAME, changeScore); } public function addToStage(e:Event):void { this.x = 0; this.y = 0; } private function showwinFunction(e:MouseEvent):void { gameScore+=50; } private function changeScore(e:Event):void { scoreText.text =""+gameScore; } public function showgameoverFunction(e:MouseEvent) { mainClass.showGameOver(); gameOverScore = new thegameoverclass(this); gameOverScore.setTextScore(gameScore); } } } thegameoverclass.as package { import flash.display.MovieClip; import flash.events.MouseEvent; import flash.events.*; public class thegameoverclass extends MovieClip { var mainClass:main; var scorePoints:Number; public function thegameoverclass(passedClass:main) { mainClass = passedClass; finalScore.text = "test"; } public function setTextScore(textToSet:Number) { finalScore.text = ""+scorePoints; } } }

    Read the article

  • How to change the text of the multiple asp:label using for loop in C# ASP.NET

    - by Minelava
    I want to change the asp label multiple times. Here is the asp.net code <asp:Label ID="lbl_Text1" runat="server" Text=""> <asp:Label ID="lbl_Text2" runat="server" Text=""> <asp:Label ID="lbl_Text3" runat="server" Text=""> <asp:Label ID="lbl_Text4" runat="server" Text=""> Instead of using this: C# Code lbl_Text1.Text = "hello"; lbl_Text2.Text = "hello"; lbl_Text3.Text = "hello"; lbl_Text4.Text = "hello"; I tried to use for loop for (int i = 1; i <= 4; i++) { lbl_Text[i].Text = "hello"; } And I get this error..... cannot apply indexing with [] to an expression of type 'system.web.ui.webcontrols.label' Is there anyone can help me on that?

    Read the article

1