-
大小: 19.02MB文件類型: .zip金幣: 1下載: 0 次發(fā)布日期: 2023-07-13
- 語(yǔ)言: 其他
- 標(biāo)簽: QT??flashplayer??interactive??
資源簡(jiǎn)介
QT開(kāi)發(fā)的flash播放器,播放器與flash媒體文件可以實(shí)現(xiàn)交互,通用性較強(qiáng),適合初學(xué)者!
代碼片段和文件信息
#include?“flashplyer.h“
#include?“ui_flashplyer.h“
#include?
#include?
#include?
FlashPlyer::FlashPlyer(QWidget?*parent)?:
????QWidget(parent)
????ui(new?Ui::FlashPlyer)
{
????ui->setupUi(this);
????this->setFocus();???????????????????????????????????//設(shè)置當(dāng)前控件焦點(diǎn)為主窗口
????//1.界面屬性設(shè)置,去除邊框、全屏
//????this->setWindowFlags(Qt::framelessWindowHint);????//隱藏邊框
//????this->showFullScreen();???????????????????????????//設(shè)置全屏播放
????//2.加載flash界面模塊設(shè)置
??????QString?DataName?=?qApp->applicationDirPath();
??????QString?urlOne?=?DataName+“/res/1.swf“;?????????????//播放flash畫(huà)面
??????ui->FlashWidget->dynamicCall(“LoadMovie(longstring)“0urlOne);
??????isOver?=?true;
????//3.延時(shí)操作
??????timer?=?new?QTimer;
??????connect(timerSIGNAL(timeout())thisSLOT(loadFlash()));
}
FlashPlyer::~FlashPlyer()
{
????delete?ui;
}
void?FlashPlyer::keyPressEvent(QKeyEvent?*event)
{
????if(event->key()?==?Qt::Key_Enter?||?event->key()?==?Qt::Key_Return)
????{
????????qDebug()?<“Enter鍵被按下“;
????????ui->fullScreen_btn->setVisible(false);
????????this->setWindowFlags(Qt::framelessWindowHint);??????????????????????????//隱藏邊框
????????this->showFullScreen();?????????????????????????????????????????????????//設(shè)置全屏播放
????????ui->FlashWidget->setFocus();????????????????????????????????????????????//設(shè)置當(dāng)前控件焦點(diǎn)為flash播放控件
????????LoadKeyboardLayout((LPCWSTR)QString(“0x0409“).utf16()?KLF_ACTIVATE);???//設(shè)置輸入法,“0x0409“為英文輸入美式鍵盤(pán)
????????}
?????else?if(event->key()?==?Qt::Key_D)
????{
????????qDebug()?<“D被按下“;
????????//input?code?to?do?something
????}
????else?if(event->key()?==?Qt::Key_Q)
???{
???????qDebug()?<“Q被按下“;
???????ui->FlashWidget->setFocus();?????????????????????//設(shè)置當(dāng)前控件焦點(diǎn)為flash播放控件
???????LoadKeyboardLayout((LPCWSTR)QString(“0x0409“).utf16()?KLF_ACTIVATE);
???????keybd_event(81000);???????????????????????????//模擬Q鍵輸入,可與flash進(jìn)行交互,flash響應(yīng)對(duì)應(yīng)操作
???????//input?code?to?do?something
????}
}
void?FlashPlyer::loadFlash()
{
????if(isOver?==?true)
????{
????????QString?DataName?=?qApp->applicationDirPath();
????????QString?urlTwo?=?DataName+“/res/2.swf“;?????????????//播放flash畫(huà)面
????????ui->FlashWidget->dynamicCall(“LoadMovie(longstring)“0urlTwo);
????????isOver?=?false;
????}
????else
????{
????????QString?DataName?=?qApp->applicationDirPath();
????????QString?urlOne?=?DataName+“/res/1.swf“;?????????????//播放flash畫(huà)面
????????ui->FlashWidget->dynamicCall(“LoadMovie(longstring)“0urlOne);
????????isOver?=?true;
????}
????timer->stop();
}
void?FlashPlyer::on_FlashWidget_FSCommand(const?QString?&command?const?QString?&args)
{
????qDebug()?<????if?(0?==?strcmp(“f“command.toLatin1()))//結(jié)束體驗(yàn)
????{
????????qDebug()?<“結(jié)束游戲“;
????????timer->start(60000);
????????//loadFlash();
????????//input?code?to?do?something
????}
????else?if?(0?==?strcmp(“k“command.toLatin1()))//題目答對(duì)
????{
????????qDebug()?<“回答正確“;
????????//input?code?to?do?something
????}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-01-28?12:42??FlashPlyerV1\
?????文件????????1070??2019-01-26?17:02??FlashPlyerV1\FlashPlyerV1.pro
?????文件??????104132??2019-01-28?12:41??FlashPlyerV1\FlashPlyerV1.pro.user
?????文件????????4036??2019-01-28?12:41??FlashPlyerV1\flashplyer.cpp
?????文件????????1055??2019-01-28?09:08??FlashPlyerV1\flashplyer.h
?????文件????????2919??2019-01-27?11:53??FlashPlyerV1\flashplyer.ui
?????文件?????????183??2019-01-26?16:54??FlashPlyerV1\main.cpp
?????目錄???????????0??2019-01-28?12:44??Release\
?????文件?????????943??2019-01-28?12:31??Release\.qmake.stash
?????文件???????28455??2019-01-28?12:31??Release\Makefile
?????文件???????46355??2019-01-28?12:31??Release\Makefile.Debug
?????文件???????46428??2019-01-28?12:31??Release\Makefile.Release
?????目錄???????????0??2019-01-28?12:44??Release\debug\
?????目錄???????????0??2019-01-28?12:44??Release\release\
?????文件??????277504??2019-01-28?12:41??Release\release\FlashPlyerV1.exe
?????文件???????22116??2019-01-28?12:41??Release\release\flashplyer.o
?????文件????????1476??2019-01-28?12:31??Release\release\main.o
?????文件????????4121??2019-01-28?12:31??Release\release\moc_flashplyer.cpp
?????文件????????8987??2019-01-28?12:31??Release\release\moc_flashplyer.o
?????文件????????9894??2019-01-28?12:31??Release\release\moc_predefs.h
?????目錄???????????0??2019-01-28?12:44??Release\release\res\
?????文件?????9899647??2019-01-22?16:20??Release\release\res\1.swf
?????文件?????9899647??2019-01-22?16:20??Release\release\res\2.swf
?????文件????????3848??2019-01-28?12:31??Release\ui_flashplyer.h
評(píng)論
共有 條評(píng)論