Jump to content


Photo

Javascript No Texto Do Arquivo Txt Que Muda Frame


  • Faça o login para participar
2 replies to this topic

#1 iamgita

iamgita

    Novato no fórum

  • Usuários
  • 24 posts
  • Sexo:Não informado

Posted 20/08/2004, 15:09

Tenho um campo texto no flash que pega o valor de uma variável em um arquivo externo .txt. Este campo aceita tags html.

Se preciso de colocar um link externo é tranquilo:
<a href="www.site.com.br" target="_blank">link</a>
Quando preciso de um alert, eu uso:
<a href="java script:alert('oi');void(0);">link</a>
Funciona muito bem!

Só que eu quero colocar no arquivo txt um comando para mudar o frame do meu movie.
Tem como colocar algo como
<a href="java script:gotoAndStop(7);void(0);">link</a>
ou
<a href="java script:meu_mc.gotoAndStop(7);void(0);">link</a>
(sei que não funciona, tô querendo só mostrar pra vocês entenderem o que eu quero)

Valeu!

nu+1[]

ps: Pra quem não sabe, pra você colocar um texto externo no seu campo de texto, coloque no 1º frame:
loadVariablesNum("arquivo.txt",0);

no campo texto dinâmico coloque para pegar a variável: meuvalor

no arquivo.txt coloque o texto:
&meuvalor=Aqui esta o conteudo da minha variável

(o & define uma variável)

#2 DuRanG

DuRanG

    Doutor

  • Usuários
  • 988 posts
  • Sexo:Masculino
  • Localidade:Brasília - DF

Posted 25/08/2004, 21:48

asfunction
Availability
Flash Player 5.

Usage
asfunction:function:Function,"parameter":String

Parameters
function An identifier for a function.

parameter A string that is passed to the function named in the function parameter.

Returns
Nothing.

Description
Protocol; a special protocol for URLs in HTML text fields. In HTML text fields, text can be linked using the HTML A tag. The HREF attribute of the A tag contains a URL that can be for a standard protocol such as HTTP, HTTPS, or FTP. The asfunction protocol is an additional protocol that is specific to Flash, which causes the link to invoke an ActionScript function.

Example
In the following example, the playMP3() function is defined. The TextField object list_txt is created and set so HTML text can be rendered. The text Track 1 and Track 2 are links inside the text field. The playMP3() function is called when the user clicks either link and plays the MP3 that is passed as a parameter of the asfunction call.

var myMP3:Sound = new Sound();
function playMP3(mp3:String) {
  myMP3.loadSound(mp3, true);
  myMP3.onLoad = function(success) {
    if (!success) {
      // code to handle errors here
    }
  };
}
this.createTextField("list_txt", this.getNextHighestDepth(), 0, 0, 200, 100);
list_txt.autoSize = true;
list_txt.html = true;
list_txt.multiline = true;
list_txt.htmlText = "<a href=\"asfunction:playMP3,track1.mp3\">Track 1</a><br>";
list_txt.htmlText += "<a href=\"asfunction:playMP3,track2.mp3\">Track 2</a><br>";

When you click a link, the MP3 sound file streams in Flash Player.


Leandro Ferreira

#3 iamgita

iamgita

    Novato no fórum

  • Usuários
  • 24 posts
  • Sexo:Não informado

Posted 15/09/2004, 08:58

Não vi como solucionar meu problema, tentei mudar um frame no filme através de um comando javascript num campo texto, como se no texto tivesse um link que mudasse o frame de um movieclip.
Deu pra entender?
Valeu!

nu+1[]
IamGita




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq