Форум Flasher.ru
Ближайшие курсы в Школе RealTime
Список интенсивных курсов: [см.]  
  
Специальные предложения: [см.]  
  
 
Блоги Правила Справка Пользователи Календарь Сообщения за день
 

Вернуться   Форум Flasher.ru > Flash > ActionScript 1.0/2.0

Версия для печати  Отправить по электронной почте    « Предыдущая тема | Следующая тема »  
Опции темы Опции просмотра
 
Создать новую тему Ответ
Старый 25.09.2007, 10:24
enepx вне форума Посмотреть профиль Отправить личное сообщение для enepx Посетить домашнюю страницу enepx Найти все сообщения от enepx
  № 1  
Ответить с цитированием
enepx
 
Аватар для enepx

Регистрация: Aug 2006
Адрес: Мюнхен
Сообщений: 509
Отправить сообщение для enepx с помощью ICQ Отправить сообщение для enepx с помощью Yahoo Отправить сообщение для enepx с помощью Skype™
Attention как вызвать js?

Не могу понять, все делаю по инструкции через flashmovie_DoFSCommand(command, args) , хочу вызвать js-функцию, например,
Код:
alert("УРА")
Юзаю Firefox2. Помогите.

Инструкция:
Код:
Create a new FLA file, and save it as myMovie.fla. 
Drag two instances of the Button component to the Stage and give them the instance names window_btn and alert_btn, respectively, and the labels Open Window and Alert. 
Insert a new layer on the Timeline, and rename it Actions. 
Select Frame 1 of the Actions layer, and add the following ActionScript in the Actions panel: window_btn.onRelease = function() {
    fscommand("popup", "http://www.adobe.com/");
};
alert_btn.onRelease = function() {
    fscommand("alert", "You clicked the button.");
};

Select File > Publish Settings, and make sure that Flash with FSCommand is selected in the Template menu on the HTML tab. 
Select File > Publish to generate the SWF and HTML files. 
In an HTML or text editor, open the HTML file that was generated in step 6 and examine the code. When you published your SWF file using the Flash with FSCommand template on the HTML tab of the Publish Settings dialog box, some additional code was inserted in the HTML file. The SWF file's NAME and ID attributes are the filename. For example, for the file myMovie.fla, the attributes would be set to myMovie. 
In the HTML file, add the following JavaScript code where the document says // Place your code here.: if (command == "alert") {
    alert(args);
} else if (command == "popup") {
    window.open(args, "mmwin", "width=500,height=300");
}

(For more information about publishing, see Using Flash.)
Alternatively, for Microsoft Internet Explorer applications, you can attach an event handler directly in the <SCRIPT> tag, as shown in this example:

<script Language="JavaScript" event="FSCommand (command, args)" for="theMovie">
...
</script>

Save and close the HTML file. 
When you're editing HTML files outside of Flash in this way, remember that you must deselect the HTML check box in File > Publish Settings, or your HTML code is overwritten by Flash when you republish.

In a web browser, open the HTML file to view it. Click the Open Window button; a window is opened to the Macromedia website. Click the Alert button; an alert window appears.

Старый 25.09.2007, 10:41
CorC вне форума Посмотреть профиль Отправить личное сообщение для CorC Найти все сообщения от CorC
  № 2  
Ответить с цитированием
CorC
 
Аватар для CorC

Регистрация: Jul 2006
Адрес: Земля>Россия>Вологда
Сообщений: 3,056
Отправить сообщение для CorC с помощью ICQ Отправить сообщение для CorC с помощью MSN Отправить сообщение для CorC с помощью Skype™
Проще забыть про flashmovie_DoFSCommand с fscommand и использовать
Код:
getURL("javascript:<имя функции>();");
А про fscommand вы недочитали
Цитата:
Код:
function myDocument_DoFSCommand(command, args) {
 if (command == "messagebox") {
 alert(args);
 }
}

In the Flash document, add fscommand() to a button:
Код:
fscommand("messagebox", "This is a message box");
http://livedocs.macromedia.com/flash.../00001727.html
__________________
"We Are The Champions My Friends!" Queen


Последний раз редактировалось CorC; 25.09.2007 в 10:45.
Старый 25.09.2007, 10:47
enepx вне форума Посмотреть профиль Отправить личное сообщение для enepx Посетить домашнюю страницу enepx Найти все сообщения от enepx
  № 3  
Ответить с цитированием
enepx
 
Аватар для enepx

Регистрация: Aug 2006
Адрес: Мюнхен
Сообщений: 509
Отправить сообщение для enepx с помощью ICQ Отправить сообщение для enepx с помощью Yahoo Отправить сообщение для enepx с помощью Skype™
да все я сделал по фскомманде, добавил все и дочитал.

Код:
getURL("javascript:alert(\"test\");");
тупо не работает! как сделать еще вызов своей функции?


Последний раз редактировалось etc; 25.09.2007 в 12:57.
Старый 25.09.2007, 12:57
etc вне форума Посмотреть профиль Найти все сообщения от etc
  № 4  
Ответить с цитированием
etc
Et cetera
 
Аватар для etc

Регистрация: Sep 2002
Сообщений: 30,787
Заглянуть в FAQ в тему по настройке локального доступа.

Создать новую тему Ответ Часовой пояс GMT +4, время: 14:04.
Быстрый переход
  « Предыдущая тема | Следующая тема »  

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.


 


Часовой пояс GMT +4, время: 14:04.


Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.