Flex页面跳转的五种实现方式

Flex中实现Flex页面跳转以下几种方式:

Flex页面跳转方式一:使用ViewStack组件,把要跳转的页新建成MXMLComponent,然后通过ViewStack组件把这些页包含进来,然后再通过改变ViewStack的selectedItem或者selectedChild来切换这些页。

 
 
  1. <mx:ViewStack id="storeViews" width="100%" height="550" 
  2. creationPolicy="all"> 
  3. <shouye id="homeView" label="首页" showEffect="WipeDown" hideEffect="WipeUp"/> 
  4. <leixing id="pView" label="模板类型"showEffect="WipeDown" hideEffect="WipeUp"/> 
  5. <make id="supportView" label="立即制作"showEffect="WipeDown"hideEffect="WipeUp"/> 
  6. </mx:ViewStack> 
  7. <mx:Buttonclick="storeViews.selectedChild=homeView;"/> 
  8.  

Flex页面跳转方式二:使用navigateToURL,主要方式如下:

 
 
  1. varurl:String="http://localhost:8080/Flex_Java_Demo/  
  2. welcome.html";  
  3. varrequest:URLRequest=new URLRequest(url);  
  4. navigateToURL(request,"_blank");  
  5.  

这个方法实现Flex页面切换时会弹出新的页面,而不是只变换url

Flex页面跳转方式三:引用flash中的importflash.external.ExternalInterface这个接口,它能提供像jsp中window.location.href方法一样方便,主要代码为:
 

 
 
  1. ExternalInterface.call("function(){window.location.  
  2. href='http://localhost:8080/Flex_J2eeDemo  
  3. /bin/Welcome.html';}");  

Flex页面跳转方式四:使用组件技术,把不同的页面做成component,然后通过TabNavigator等进行切换,通过使用state实现跳转。

Flex页面跳转方式五:把不同的页面做成Module,然后使用ModuleLoder来进行加载切换。


  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
Expo 框架可以使用 React Navigation 库实现页面跳转。 1. 首先,在终端中使用以下命令安装 React Navigation 库: ``` npm install @react-navigation/native ``` 2. 安装所需的依赖: ``` expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view ``` 3. 接着,在 App.js 文件中引入所需的组件: ```javascript import { NavigationContainer } from '@react-navigation/native'; import { createStackNavigator } from '@react-navigation/stack'; ``` 4. 在 App.js 文件中创建 StackNavigator: ```javascript const Stack = createStackNavigator(); function App() { return ( <NavigationContainer> <Stack.Navigator> <Stack.Screen name="Home" component={HomeScreen} /> <Stack.Screen name="Details" component={DetailsScreen} /> </Stack.Navigator> </NavigationContainer> ); } ``` 5. 创建两个屏幕组件 HomeScreen 和 DetailsScreen: ```javascript function HomeScreen({ navigation }) { return ( <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> <Text>Home Screen</Text> <Button title="Go to Details" onPress={() => navigation.navigate('Details')} /> </View> ); } function DetailsScreen({ navigation }) { return ( <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> <Text>Details Screen</Text> <Button title="Go to Home" onPress={() => navigation.navigate('Home')} /> </View> ); } ``` 6. 在 HomeScreen 组件中添加一个按钮,点击后跳转到 DetailsScreen 组件,同时在 DetailsScreen 组件中添加一个按钮,点击后返回 HomeScreen 组件。 这样就可以使用 Expo 和 React Navigation 实现页面的跳转了。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值