asfunction [AS 2]
<a href="asfunction:NazwaFunkcji, [parametr]">Utwór 1</a>
Specjalny protokóÅ‚ dla adresów URL plików, które pozwalajÄ… linkÄ… (<a href) łączyć siÄ™ z ActionScript'em (wywoÅ‚ywać funkcje) dla pola we Flashu.
Kompatybilność: Flash5+
Listing
//linki Utwór 1 oraz Utwór 2 będą wywoływać funkcję playMP3 z odpowiednim parametrem ustawiony w znaczniku <a href
//tworzenie dźwięku
var mojMP3:Sound = new Sound();
//funkcja odtwarzania
function playMP3(mp3:String) {
myMP3.loadSound(mp3, true);
myMP3.onLoad = function(success) {
if (!success) {
// kod do przechwycenia błędów
}
};
}
//tworzenie pola oraz linków
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, utwor1.mp3\">Utwór 1</a><br>";
list_txt.htmlText += "<a href=\"asfunction:playMP3, utwór2.mp3\">Utwór 2</a><br>";
//tworzenie dźwięku
var mojMP3:Sound = new Sound();
//funkcja odtwarzania
function playMP3(mp3:String) {
myMP3.loadSound(mp3, true);
myMP3.onLoad = function(success) {
if (!success) {
// kod do przechwycenia błędów
}
};
}
//tworzenie pola oraz linków
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, utwor1.mp3\">Utwór 1</a><br>";
list_txt.htmlText += "<a href=\"asfunction:playMP3, utwór2.mp3\">Utwór 2</a><br>";
Dodano przez: divix
Ranga: Administrator serwisu Punktów: 38473
Ranga: Administrator serwisu Punktów: 38473
Komentarze użytkowników
:: Losowe artykuły

:: Wymiana linków

Modowe inspiracje |
Android Gry i Aplikacje |
ZaplanujTransport.pl: Przeprowadzki, transport, aukcje |
Logo dla firmy |
Change Tires - Car Weather Forecast Reminder |
Zend Framework 3. Developer's Guide |
IT Books Reviews and Programming: JS, JAVA, PHP, ANDROID, CSS |
Katalog roślin |
Programming articles of: JAVA, PHP, C++, Pyth, JavaScript and so on..