webForumDet fria alternativet

Listbox...

Flash

1 svar · 168 visningar · startad av Viktor

Medlem sedan aug. 20021 752 inlägg
Frågan#1

När jag skapar ett tomt projekt i Flash 2004 och bara lägger till en listbox så kan jag utan problem lägga till items och göra annat på den i onLoad, men när jag försöker lägga till en i mitt projekt där jag redan har några saker så fungerar det inte längre trots att jag skriver exakt lika dant.
Här är koden

onLoad=function()
{
	_root.lstTest.addItem("Viktor");
}

och här är variabel output,

Level #0:
Variable _level0.$version = "WIN 7,0,14,0"
Variable _level0.MessageHandler = [function 'MessageHandler'] {
    prototype:[object #2, class 'Object'] {
      getSocket:[function 'getSocket'],
      myOnData:[function 'onData'],
      connect:[function 'connect'],
      login:[function 'login'],
      sendData:[function 'sendData'],
      closeConnection:[function 'closeConnection'],
      host:[function 'host'],
      cancelHost:[function 'cancelHost'],
      join:[function 'join'],
      cancelGame:[function 'cancelGame'],
      getHostlist:[function 'getHostlist']
    }
  }
Variable _level0.myURL = undefined
Variable _level0.myPort = undefined
Variable _level0.mySocket = undefined
Variable _level0.onHostlist = undefined
Variable _level0.onPlayerList = undefined
Variable _level0.onLogin = undefined
Variable _level0.myMsgHandler = [object #14, class 'MessageHandler'] {
    myURL:"192.168.0.11",
    myPort:2000,
    onHostlist:[function 'onHostlist'],
    onPlayerList:null,
    mySocket:[object #16, class 'XMLSocket'] {
      _this:[object #14, class 'MessageHandler'],
      onData:[function 'onData'],
      onConnect:[function 'onConnect']
    },
    onLogin:[function 'onLogin']
  }
Variable _level0.connect = [function]
Variable _level0.myOnHostlist = [function 'onHostlist']
Variable _level0.myOnLogin = [function 'onLogin']
Variable _level0.showFrame = [function]
Variable _level0.myOnConnect = [function 'onConnect']
Variable _level0.onLoad = [function]
Movie Clip: Target="_level0.bgLogin"
Movie Clip: Target="_level0.bgLobby"
Button: Target="_level0.btnLogin"
Variable _level0.btnLogin.onPress = [function 'onPress']
Variable _level0.btnLogin.tabIndex = [getter/setter] undefined
Edit Text: Target="_level0.txtUName"
    variable = "txtUserName",
    text = ,
    htmlText = ,
    html = false, textWidth = 0, textHeight = 55, maxChars = null,
    borderColor = 0x000000, backgroundColor = 0xFFFFFF, textColor = 0x000000, border = false,
    background = false, wordWrap = false, password = false, multiline = false,
    selectable = true, scroll = 1, hscroll = 0, maxscroll = 1,
    maxhscroll = 0, bottomScroll = 1,
    type = "input",
    embedFonts = false, restrict = null, length = 0, tabIndex = undefined,
    autoSize = "none",
    mouseWheelEnabled = true, condenseWhite = false, styleSheet = undefined
Button: Target="_level0.btnHost"
Variable _level0.btnHost.tabIndex = [getter/setter] undefined
Button: Target="_level0.btnJoin"
Variable _level0.btnJoin.onPress = [function 'onPress']
Variable _level0.btnJoin.tabIndex = [getter/setter] undefined
Edit Text: Target="_level0.txtGName"
    variable = "txtGameName",
    text = ,
    htmlText = ,
    html = false, textWidth = 0, textHeight = 27, maxChars = null,
    borderColor = 0x000000, backgroundColor = 0xFFFFFF, textColor = 0x000000, border = false,
    background = false, wordWrap = false, password = false, multiline = false,
    selectable = true, scroll = 1, hscroll = 0, maxscroll = 1,
    maxhscroll = 0, bottomScroll = 1,
    type = "input",
    embedFonts = false, restrict = null, length = 0, tabIndex = undefined,
    autoSize = "none",
    mouseWheelEnabled = true, condenseWhite = false, styleSheet = undefined
Movie Clip: Target="_level0.instance1"
Variable _level0.instance1.multipleSelection = false
Variable _level0.instance1.rowHeight = 20
Movie Clip: Target="_level0.instance1.boundingBox_mc"
Movie Clip: Target="_level0.lstTest"
Variable _level0.lstTest.multipleSelection = false
Variable _level0.lstTest.rowHeight = 20
Movie Clip: Target="_level0.lstTest.boundingBox_mc"

och objekt output

Level #0: Frame=1
  Movie Clip: Frame=1 Target="_level0.bgLogin"
    Shape:
    Text:
    Shape:
    Text:
    Text:
  Movie Clip: Frame=1 Target="_level0.bgLobby"
    Shape:
    Text:
    Text:
    Text:
  Button: Target="_level0.btnLogin"
    Shape:
    Text:
  Edit Text: Target="_level0.txtUName" Variable=_level0.txtUserName Visible=true Text = "
  Button: Target="_level0.btnHost"
    Shape:
    Text:
  Button: Target="_level0.btnJoin"
    Shape:
    Text:
  Edit Text: Target="_level0.txtGName" Variable=_level0.txtGameName Visible=false Text = "
  Movie Clip: Frame=1 Target="_level0.instance1"
    Movie Clip: Frame=1 Target="_level0.instance1.boundingBox_mc"
      Shape:
  Movie Clip: Frame=1 Target="_level0.lstTest"
    Movie Clip: Frame=1 Target="_level0.lstTest.boundingBox_mc"
      Shape:

Börjar hata det här programmet på alvar nu, man gör samma sak (tycker jag) men får hela tiden olika resultat :(

/Viktor

Medlem sedan aug. 20021 752 inlägg
#2

Eftersom projektet jag gör ska vara kompatibelt med Flash 6.0 och listbox tydligen är en ny sak i flash 7.0 så gick den inte att använda, som vanligt utan felmedelanden...
Att det fungerade med nya projekt var eftersom jag inte ställt in dem på att fungera med Flash 6.0.

/Viktor

503 ms totalt · 4 externa anrop · v20260731065814-full.1dc6f849
348 ms — deklarationer (db)
0 ms — hämta statistik (cache)
138 ms — hämta tråd, inlägg och bilagor (db)
357 ms — ändringar (db)